[llvm-commits] CVS: llvm-test/TimedExec.sh
Evan Cheng
evan.cheng at apple.com
Wed Jun 7 13:15:09 PDT 2006
Changes in directory llvm-test:
TimedExec.sh updated: 1.1 -> 1.2
---
Log message:
The watchdog process should wakes up every sec to check if the parent has completed.
---
Diffs of the changes: (+10 -4)
TimedExec.sh | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
Index: llvm-test/TimedExec.sh
diff -u llvm-test/TimedExec.sh:1.1 llvm-test/TimedExec.sh:1.2
--- llvm-test/TimedExec.sh:1.1 Wed Jun 7 13:57:36 2006
+++ llvm-test/TimedExec.sh Wed Jun 7 15:14:57 2006
@@ -24,14 +24,20 @@
if [ -z "$PARENT" ]; then
# Start a watchdog process
$0 -p $$ $TIMEOUT $PROGRAM $* &
- WATCHDOG="$!"
exec "$@"
- # I am done first. kill the watch dog.
- kill $WATCHDOG && (sleep 2; kill -1 $WATCHDOG) && (sleep 2; kill -9 $WATCHDOG)
else
# Sleep for a specified time then wake up to kill the parent process.
exec > /dev/null 2>&1
- sleep $TIMEOUT
+ SEC=0
+ while [ $SEC -lt $TIMEOUT ]; do
+ sleep 1
+ # Check if parent has completed.
+ kill -s INFO $PATENT 2>/dev/null
+ if [ $? -eq 1 ]; then
+ exit 0
+ fi
+ SEC=$(($SEC + 1))
+ done
kill $PARENT && (sleep 2; kill -1 $PARENT) && (sleep 2; kill -9 $PARENT)
fi
More information about the llvm-commits
mailing list