Created
October 20, 2013 19:10
-
-
Save obfusk/7073863 to your computer and use it in GitHub Desktop.
sigusr1 + wait
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ME=$$; echo "I'm $ME" | |
( echo $BASHPID; sleep 5; echo 1; kill -SIGUSR1 $ME ) & | |
( echo $BASHPID; sleep 10; echo 2; kill -SIGUSR1 $ME ) & | |
( echo $BASHPID; sleep 15; echo 3; kill -SIGUSR1 $ME ) & | |
foo () { echo "USR1 received"; } | |
bar () { echo "USR2 received"; } | |
trap foo SIGUSR1 | |
trap bar SIGUSR2 | |
while :; do | |
wait && break | |
done | |
echo DONE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment