select() problems
select() problems
- Subject: select() problems
- From: Jamil Weatherbee <email@hidden>
- Date: Tue, 2 Dec 2008 19:42:52 -0800
This may be a simple one but I haven't figured it out.
Suppose you have a server that does (in pseudo code):
signal_handler ()
{
if TERM signal then
runserver = 0;
}
main ()
{
for (runserver=1;runserver;)
{
select (descriptors, timeout=1second);
do descriptor event based stuff;
do periodic stuff;
}
exit gracefully;
}
Now if you send a TERM signal to this process but for whatever reason
there is no activity on the file descriptors. Then the process will
hang into the select() until a descriptor becomes ready. You would
think that the 1 second should timeout and then it should exit
gracefully (which is the intent).
It seems the best I can tell is that the select() call is getting
restarted due to the signal but somehow it is restarted without the
timeout.
Any easy solutions?
-Jamil
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden