I found this very cool but undocumented (why?) feature that you can
find the sender of a signal and pass a value (for realtime signals):
~/bin/ksh -c 'compound pc ; trap "pc.value=\${.sh.sig.value}
pc.pid=\${.sh.sig.pid}" RTMIN ; integer thispid=$$ ; kill -q 16#23456
-RTMIN $thispid &  ; wait ; printf "%s\n" "${pc}"'
(
        pid=984
        value=16#23456
)

Now I thought this could be used create scripts which handle SIGCHLD
in an event-driven manner, but the concept doesn't work for SIGCHLD
traps:
~/bin/ksh -c 'compound pc=( integer value=-1 pid=-1 ) ; trap
"pc.value=\${.sh.sig.value} pc.pid=\${.sh.sig.pid} ; print trapCHLD"
CHLD ; integer thispid=$$ ; sleep 2 &  ; wait ; printf "%s\n" "${pc}"'
trapCHLD
(
        typeset -l -i pid=0
        typeset -l -i value=0
)

Why does that happen?

Lionel
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to