Minimize sleeps
This commit is contained in:
parent
a44e4e2e87
commit
3da3e86007
|
@ -21,7 +21,7 @@ start() {
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
ebegin "Stopping bumblebee nVidia Optimus"
|
ebegin "Stopping bumblebee nVidia Optimus"
|
||||||
kill `cat $PIDFILE 2>&1` > /dev/null 2>&1 ; sleep 1 ; kill -9 `cat $PIDFILE 2>&1` > /dev/null 2>&1
|
kill `cat $PIDFILE 2>&1` > /dev/null 2>&1
|
||||||
snail.nv_pwr_off || eend -1
|
snail.nv_pwr_off || eend -1
|
||||||
eend $result
|
eend $result
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,17 +4,19 @@ LOCK_FILE=/tmp/.snail.nvrun.lock
|
||||||
NVRUN=/usr/local/bin/nvrun
|
NVRUN=/usr/local/bin/nvrun
|
||||||
|
|
||||||
(
|
(
|
||||||
for i in `seq 8`; do
|
for i in `seq 16`; do
|
||||||
flock -n 9
|
flock -n 9
|
||||||
|
status=$?
|
||||||
|
|
||||||
if [[ 0 -ne $? && 5 -eq $i ]]; then
|
if [[ 0 -ne $status && 5 -eq $i ]]; then
|
||||||
echo "Cann't lock $COUNT_FILE. Exiting..."
|
echo "Cann't lock $COUNT_FILE. Exiting..."
|
||||||
exit -1
|
exit -1
|
||||||
|
|
||||||
elif [ 0 -eq $? ]; then
|
elif [ 0 -eq $status ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo sleep 1
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -30,17 +32,19 @@ NVRUN=/usr/local/bin/nvrun
|
||||||
snail.nvrun "$@"
|
snail.nvrun "$@"
|
||||||
|
|
||||||
(
|
(
|
||||||
for i in `seq 8`; do
|
for i in `seq 16`; do
|
||||||
flock -n 9
|
flock -n 9
|
||||||
|
status=$?
|
||||||
|
|
||||||
if [[ 0 -ne $? && 5 -eq $i ]]; then
|
if [[ 0 -ne $status && 5 -eq $i ]]; then
|
||||||
echo "Cann't lock $COUNT_FILE. Exiting..."
|
echo "Cann't lock $COUNT_FILE. Exiting..."
|
||||||
exit -1
|
exit -1
|
||||||
|
|
||||||
elif [ 0 -eq $? ]; then
|
elif [ 0 -eq $status ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo sleep 1 aaa
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -9,17 +9,19 @@ while [ 1 ]; do
|
||||||
if [ 0 -ne $? ]; then
|
if [ 0 -ne $? ]; then
|
||||||
|
|
||||||
(
|
(
|
||||||
for i in `seq 16`; do
|
for i in `seq 32`; do
|
||||||
flock -n 9
|
flock -n 9
|
||||||
|
status=$?
|
||||||
|
|
||||||
if [[ 0 -ne $? && 5 -eq $i ]]; then
|
if [[ 0 -ne $status && 5 -eq $i ]]; then
|
||||||
echo "Cann't lock $COUNT_FILE. Exiting..."
|
echo "Cann't lock $COUNT_FILE. Exiting..."
|
||||||
exit -1
|
exit -1
|
||||||
|
|
||||||
elif [ 0 -eq $? ]; then
|
elif [ 0 -eq $status ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo sleep 1
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -30,6 +32,7 @@ while [ 1 ]; do
|
||||||
) 9>$LOCK_FILE ; exit $?
|
) 9>$LOCK_FILE ; exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo sleep 1
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue