|
Waiting on more then one event -- Accept_r: msg#00001web.fastcgi.devel
Hello, There is a problem when I want to work with multiple threads and receive other notifications for example, timeout, cache notifications etc. The purposed solution on the lists is: pthread_mutex_lock select(incoming fd,other event fd,timeout) FCGX_Accept_r() pthread_mutex_unlock Comments: - I can't do select outside lock because I may find two threads accepting same request and one of them being blocked. - FCGX_Accept_r does much more then just accept reads environment parameters from the socket etc... All this time other threads can not accept new connections. For me ideal solution would be calling accept outside the socket, unlocking mutex and continuing to normal Accept_r. Something like that. pthread_mutex_lock select(incoming fd,other event fd,timeout) new_sock=accept(fd); pthread_mutex_unlock FCGX_Accept_r(new_sock) Viewing the fcgiapp.c code I found that Accept_r checks whether icpFd assigned the value, thus I tried following way: request->ipcFd= accept(main_fd, (struct sockaddr *)&sa,&len); request->keepConnection=1; and then FCGX_Accept_r(request) It seems to be work and I had written a simple program based on thread.c based on this techique that accepts external signal (SIGINT) and performs nice shutdown. But I'm absolutely not sure if: - is this correct way to do things? - may this change in future? - can similar API be added to the library? if such way is OK I may write a patch and send. Thanks, Artyom P.S.: The program is attached.
fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Debugging help: POSTs, SSL, mod_fastcgi, and PHP5: 00001, Garrett Wollman |
|---|---|
| Next by Date: | Re: Waiting on more then one event -- Accept_r: 00001, Robert Jordan |
| Previous by Thread: | Re: Debugging help: POSTs, SSL, mod_fastcgi, and PHP5i: 00001, Garrett Wollman |
| Next by Thread: | Re: Waiting on more then one event -- Accept_r: 00001, Robert Jordan |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |