Differential D11673 Diff 31126 cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
Show All 32 Lines | |||||
# The -w option can be used to permit destructive actions in D programs. | # The -w option can be used to permit destructive actions in D programs. | ||||
# | # | ||||
# SECTION: dtrace Utility/-w Option; | # SECTION: dtrace Utility/-w Option; | ||||
# dtrace Utility/-f Option | # dtrace Utility/-f Option | ||||
# | # | ||||
## | ## | ||||
reader() | |||||
{ | |||||
while true | |||||
do | |||||
cat /etc/motd > /dev/null | |||||
ngie: Could you please add a `sleep 0.1` here to avoid burning CPU too badly? Both FreeBSD and… | |||||
done | |||||
} | |||||
if [ $# != 1 ]; then | if [ $# != 1 ]; then | ||||
echo expected one argument: '<'dtrace-path'>' | echo expected one argument: '<'dtrace-path'>' | ||||
exit 2 | exit 2 | ||||
fi | fi | ||||
dtrace=$1 | dtrace=$1 | ||||
reader & | |||||
child=$! | |||||
$dtrace -qwf read'{chill(15); printf("Done chilling"); exit(0);}' | $dtrace -qwf read'{chill(15); printf("Done chilling"); exit(0);}' | ||||
status=$? | status=$? | ||||
if [ "$status" -ne 0 ]; then | if [ "$status" -ne 0 ]; then | ||||
echo $tst: dtrace failed | echo $tst: dtrace failed | ||||
fi | fi | ||||
kill $child | |||||
exit $status | exit $status |
Could you please add a sleep 0.1 here to avoid burning CPU too badly? Both FreeBSD and Solaris's version of sleep(1) support floating point precision.