On Wed, Jun 09, 2004 at 06:52:16PM +0300, Shachar Shemesh wrote:

> Now here's the thing. Sometimes, I can see that the ping returned fairly 
> immediately, but the full timeout was spent. I suspect that, due to the 
> fact pselect is not a system call in Linux, ping has indeed finished 
> before the pselect, and the signal got lost. Does anyone have any 
> alternative solutions to implement what I'm doing here?

how about replacing the signal with e.g. a pipe? i.e. fork twice, have
the first son share a pipe with the father, then fork & exec the ping,
and wait on it. Once the ping returns, write to the pipe. In the
father, select on the pipe with the timeout you want. No async events
(signals), no race... 

Cheers, 
Muli 
-- 
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/

Attachment: signature.asc
Description: Digital signature

Reply via email to