Re: select() problems
Re: select() problems
- Subject: Re: select() problems
- From: "mm w" <email@hidden>
- Date: Tue, 2 Dec 2008 20:33:17 -0800
maybe by clearing the descriptor or the timeout -> 0
On Tue, Dec 2, 2008 at 7:42 PM, Jamil Weatherbee
<email@hidden> wrote:
> 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
>
--
-mmw
_______________________________________________
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