grabbers: Introduce grabbers library and V4L2 grabber.
[gfxprim.git] / build / liblock.sh
blob2af11e4c5bfc498fc31d8922c7aea36e262ae621
2 # Takes directory as parameter
4 spinlock()
6 I=0
7 #echo -n "Trying to acquire lock in '$1' ."
8 while ! `mkdir "$1/.lock" &> /dev/null`; do
9 sleep 1;
10 ((I=I+1))
11 echo $I
12 if [ $I -gt 10 ]; then
13 echo "Failed to acquire lock '`pwd`/.lock'"
14 exit 1
16 # echo -n .
17 done
18 #echo " done"
21 spinunlock()
23 #echo "Removing lock in '$1'"
24 rmdir "$1/.lock" &> /dev/null