Re: running code after FCGX_Accept fails

"alexander johnson" <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel,gmane.spam.detected
Message-ID <[email protected]>
Hi,
Sorry if I was unclear, given the following code:

void main()
{
//initialization code

while(FCGX_Accept( &in, &out, &err, &envp ) >=0)    <---- (1)
{
processRequests();

}
cleanup();                          <----- (2)

}//end of program

My code will happily run through the while loop above while my program
is still running.  My problem is that when my program stops running
say due to Apache shutting down or closing the fcgi, my code never
gets as far as the cleanup() function (2).  When apache terminates the
fcgi, my code exits at (1) so never makes it to (2).  I need to run
(2) before the program exits.  No matter what way the fcgi is
terminated it will always exit at (1)


Thanks

Alex

On 7/27/07, Sven Verdoolaege <[email protected]> wrote:
> On Thu, Jul 26, 2007 at 04:51:02PM +0100, alexander johnson wrote:
> > Hi,
> > There some very important cleanup code i need to run after FCGX_Accept
> > == -1 and exits its loop.  The problem is that the program exits
> > immediately after FCGX_Accept == -1 so  cant run any code after.
>
> You'll have to be a bit more specific.  Are you saying that FCGX_Accept
> never returns and just exists or that your code exits after FCGX_Accept
> returns?  In the latter case, there's not much we can do to help you.
>
> In any case, FCGX_Accept does not return -1, unless the error happens
> to be EPERM.  Why do you think it does?
>
> skimo
>


-- 
Alex
___________________________________
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.