Re: FCGI_FAIL_ACCEPT_ON_INTR
Richard Levenberg <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Im using FreeBSD 6.1. When I take away my own signal handler and send the process the TERM signal, the whole process exits without calling the cleanup code. I looked at the source for FCGI and see that the OS_Accept is in a 'do' loop and one of the truth tests it uses to determine if it should loop is whether FCGI_FAIL_ACCEPT_ON_INTR is 'on' So I guess what I am asking is how to pass that TERM to the OS_Accept but then have it catch so that I can continue processing the cleanup code. Maybe this has nothing to do with FCGI per se? r Emil A Eklund wrote: > What platform are you using? > > It should work out of the box under Unix, however as > FCGI_FAIL_ACCEPT_ON_INTR is not supported under windows in the > official devel package a patch is required. > > I have one I made a few years ago laying around somewhere. I'll try to > find it. > > -- > Emil A Eklund > > ----- Original Message ----- From: "Richard Levenberg" <[email protected]> > To: <fastcgi-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org> > Sent: Tuesday, December 05, 2006 07:33 > Subject: [FASTCGI] FCGI_FAIL_ACCEPT_ON_INTR > > > I'm not exactly sure what this setting is supposed to do? My code looks > like this: > > listen_socket = FCGX_OpenSocket(":9000", 100); > FCGX_Init(); > FCGX_InitRequest(&request, listen_socket, 0 /* > FCGI_FAIL_ACCEPT_ON_INTR */); > sig_int_flag = 0; > > while ((sig_int_flag == 0) && (FCGX_Accept_r(&request) >= 0)) { > char *content_type; > FCGX_FPrintF(request.out, "Content-type: %s\r\n\r\n", content_type); > /* do other stuff */ > FCGX_Finish_r(&request); > } > > /* clean up code starts here */ > .... > > I have a signal handler that catches SIGTERM and sets sig_int_flag to 1. > Regardless of whether I use the FCGI_FAIL_ACCEPT_ON_INTR setting or not, > the signal is caught but it never breaks out of the loop and executes > the cleanup code. What I want to do is have the loop exit and run the > cleanup code but I am not sure how to do that with or without the > FCGI_FAIL_ACCEPT_ON_INTR setting. > > r > ___________________________________ > fastcgi-developers mailing list > http://fastcgi.com/fastcgi-developers/ > -- With or without religion, you would have good people doing good things and evil people doing evil things. But for good people to do evil things, that takes religion. Steven Weinberg, quoted in The New York Times, April 20, 1999 US physicist (1933 - ) ___________________________________ fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/