libfcgi in multi threaded app
AlannY <[email protected]> Mon, 03 May 2010 19:27:24 +0400
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi there. I'm having trouble with libfcgi and my multi threaded application. I've created a socket via FCGX_OpenSocket. Everything all right. Then, I'm creating threads (5, for example). In each thread, I'm creating a request with FCGX_InitRequest (with socket, created early and FCGI_FAIL_ACCEPT_ON_INTR). Then the main loop starts. In this loop I'm calling FCGX_Accept_r on this request. Here is trouble. Some of threads can successfully accept, but some of then can't. Return code from FCGX_Accept is -9. I've tried to setup mutex before and after FCGX_Accept_r, but it's not helps ;-( At the end of thread, I'm calling FCGX_Finish_r with 0 (don't destroy socket, because it may be used by another thread). What can I do? How to sync threads? P.S. Single threaded apps works well ;-( -- )\._.,--....,'``. /, _.. \ _\ (`._ ,. `._.-(,_..'--(,_..'`-.;.'