Re: how to break out of FCGX_Accept_r

Andrej van der Zee <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Hi,

Are there any objections to the alarm() solution? The only thing 
actually needed in the SIGALRM handler is setting a flag to break out 
of  fast-cgi's Accept-loop and checking the result of FCGX_Accept_r().

Thanks,

Andrej


jimmy-HAnQDk7mx15rrK0T3/[email protected] wrote:

>Quoting Andrej van der Zee <[email protected]>:
>
>  
>
>>Hi,
>>
>>I would like to know if it is possible to break out of the pending
>>accept-call and how to do this. The problem is, I have to shutdown the
>>fast-cgi after it has been runnig for 8 hours. In c++, when I schedule a
>>threat that wakes up after 8 hours, the fast-cgi main-loop can be in two
>>situations:
>>1) It is handling a request. In this case the fast-cgi should finish
>>after handling it. This can be done with FCGX_ShutdownPending(). No
>>problem here.
>>2) The main-loop is in FCGX_Accept_r waiting for an incomming
>>connection. In this case I would like to break out of the accept and
>>immideately finish the fast-cgi application.
>>
>>In the threat that wakes up after 8 hours, I was thinking to raise a
>>signal in case 2 only. Though, how can I be sure that we are in case 2?
>>Setting flags before entering and after leaving FCGX_Accept_r is not
>>sufficient because my treat may wakeup when fast-cgi already accpeted a
>>request, but has not come out of FCGX_Accept_r yet.
>>
>>Any ideas? Any other solutions?
>>
>>Thanks a bunch!
>>
>>Andrej
>>___________________________________
>>fastcgi-developers mailing list
>>http://fastcgi.com/fastcgi-developers/
>>
>>    
>>
>
>If you are using UNIX, you could try setting alarm() and using
>a signal handler. But be careful what you do in signal handlers.
>
>Kind regards,
>Jimmy Scott
>
>
>----------------------------------------------------------------
>This message has been sent through ihosting.be
>To report spamming or other unaccepted behavior
>by a iHosting customer, please send a message 
>to [email protected]
>----------------------------------------------------------------
>
>  
>
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.