Add a todo for a POSIX semaphore problem :'(

This commit is contained in:
Yann Weber 2019-08-09 18:17:13 +02:00
commit bd6267330a
3 changed files with 15 additions and 4 deletions

View file

@ -35,7 +35,7 @@ else
fi
if test x"${enable_debug}" = x"yes"; then
AM_CFLAGS="-Wall -g"
AM_CFLAGS="-Wall -g -DDEBUG"
else
AM_CFLAGS="-Wall -Werror -O2"
fi

View file

@ -7,12 +7,12 @@ pyfcgi_LDADD = $(PYTHON_LDFLAGS)
# libpyfcgi python module
lib_LTLIBRARIES = libpyfcgi.la
libpyfcgi_la_SOURCES = python_pyfcgi.c python_ioin.c ipc.c monitor.c
libpyfcgi_la_CFLAGS = $(PYTHON_SO_CFLAGS)
libpyfcgi_la_CFLAGS = $(PYTHON_SO_CFLAGS) $(AM_CFLAGS)
libpyfcgi_la_LDFLAGS = $(PYTHON_SO_LDFLAGS)
# static librarie for check
noinst_LIBRARIES = libpyfcgi.a
libpyfcgi_a_SOURCES = logger.c pyworker.c responder.c conf.c pyutils.c python_pyfcgi.c python_ioin.c ipc.c monitor.c
libpyfcgi_a_CFLAGS = $(PYTHON_CFLAGS)
libpyfcgi_a_CFLAGS = $(PYTHON_CFLAGS) $(AM_CFLAGS)

View file

@ -610,11 +610,22 @@ static void worker_set_busy()
{
int err;
if(!_worker_idle) { return; }
/**@todo The pool handler WILL decrement the sem to figure if the pool
* is busy -__- Using sem_wait make sure that the worker will be able
* to set busy, but it can also freeze if not able to set busy....
* sem_timedwait require to get abstime -_- The better way is
* maybe to nanosleep 0.01s and retry a sem_trywait... SysV sem are
* better T_T
*/
#ifdef DEBUG
if(sem_trywait(PyFCGI_SEM(SEM_WSTATE).sem) < 0)
#else
if(sem_wait(PyFCGI_SEM(SEM_WSTATE).sem) < 0)
#endif
{
err = errno;
if(err == EAGAIN)
{//panic
{ //panic
pyfcgi_log(LOG_ALERT, "Unable to set busy ! WSTATE sem is allready 0 !!!");
_worker_idle = 0;
return;