Oron Peled wrote:
On Wednesday 09 June 2004 19:18, Shachar Shemesh wrote:RTFM pselect, and more specifically, select_tut, for an answer to that one. The short answer is "because it's the cleanest solution, assuming you have a kernel implemented pselect". Unfortunetly, Linux doesn't, hence the trouble we're seeing.
Maxim Kovgan wrote:
man pthread_createWhy would threads and mutexes help me at all?
man pthread_mutex_init
They won't, wrong direction. Instead, why blocking SIGCHLD and getting to possible critical races?
An simpler alternativeI'm not sure I see how sigprocmask enters into the picture. Are you saying to cancel one as soon as the other happens? That sounds pretty certain to fail.
seems to set up signal handlers for SIGALRM and SIGCHLD
(before forking), then fire alarm(2) (or ualarm(2)) and simply
sigprocmask(2) for one of them to happen?
Still, I think this is a jackpot. Suggested pseudo code: sigprocmask disabling SIGCHILD and SIGALRM ask for ualarm for wakeup fork (child starts ping, with or without cancelling ualarm first) sigsupend on the above two signals check which one, send INT to ping if alrm waitpid return mask to usual, cancel alarm, etc.
Does anyone see a fault in this setup, aside from the possibility that whoever called me may have had other plans for ualarm?
Shachar
-- Shachar Shemesh Lingnu Open Source Consulting ltd. http://www.lingnu.com/
================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]