[so] sigwait
Andrei Ciuca
andrei.ciuca at gmail.com
Sun Nov 25 13:35:53 EET 2007
din laborator :
"Sigwait suspendă firul apelant până unul dintre semnalele specificate în
mască este transmis spre firul de execuţie respectiv. La revenire funcţia va
salva în *sig *numărul semnalului primit. *Semnalele din mulţimea
specificată prin mască trebuie să fie anterior blocate şi nu ignorate la
intrarea în sigwait*. Dacă semnalul primit are un handler ataşat el nu va fi
apelat. Pentru mai multe detalii despre semnale pentru threaduri puteţi
folosi linkul de la sfarsit"
De aici ar rezulta ca trebuie sa facem noi ceva explicit pentru a bloca
semnalele asteptate.
-------------------------------
din linkul de la sfarsit :
"J.4: When one thread is blocked in sigwait(), other threads no longer
receive the signals sigwait() is waiting for! What happens?
It's an unfortunate consequence of how LinuxThreads implements
sigwait().*Basically, it installs signal handlers on all signals
waited for, in order
to record which signal was received. Since signal handlers are shared with
the other threads, this temporarily deactivates any signal handlers you
might have previously installed on these signals.*
Though surprising, this behavior actually seems to conform to the POSIX
standard. According to POSIX, sigwait() is guaranteed to work as expected
only if all other threads in the program block the signals waited for
(otherwise, the signals could be delivered to other threads than the one
doing sigwait(), which would make sigwait() useless). In this particular
case, the problem described in this question does not appear. "
De aici rezulta ca noi nu trebuie sa facem nimic inainte sa apelam
"sigwait", pentru ca functia o sa faca singura blocarea semnalelor pe care
le asteapta prin instalarea de handlere dummy pentru ele ...
------------------------------
cum e bine ? ;;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cursuri.cs.pub.ro/pipermail/so/attachments/20071125/9ed93316/attachment.html
More information about the so
mailing list