--- rpl/src/rpl.h 2019/02/17 16:08:41 1.332 +++ rpl/src/rpl.h 2019/02/28 12:40:44 1.333 @@ -395,8 +395,14 @@ union semun #ifdef IPCS_SYSV # ifdef DEBUG_SEMAPHORES +# define sem_init(a, b, c) ({ \ + uprintf("[%d-%llu] Semaphore %s (%p) "\ + "initialization at %s() " \ + "line #%d <%d>\n", (int) getpid(), (unsigned long long) \ + pthread_self(), \ + #a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ + sem_init_SysV(a, b, c); }) # define sem_wait(a) ({ int value; sem_getvalue(a, &value); \ - if (strstr(#a, "fork") != NULL) \ uprintf("[%d-%llu] Semaphore %s (%p) "\ "waiting at %s() " \ "line #%d <%d>\n", (int) getpid(), (unsigned long long) i\ @@ -404,7 +410,6 @@ union semun #a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ sem_wait_SysV(a); }) # define sem_trywait(a) ({ int value; sem_getvalue(a, &value); \ - if (strstr(#a, "fork") != NULL) \ uprintf("[%d-%llu] Semaphore %s (%p) "\ "trywaiting at %s() " \ "line #%d <%d>\n", (int) getpid(), (unsigned long long) i\ @@ -412,7 +417,6 @@ union semun #a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ sem_trywait_SysV(a); }) # define sem_post(a) ({ int value; sem_getvalue(a, &value); \ - if (strstr(#a, "fork") != NULL) \ uprintf("[%d-%llu] Semaphore %s (%p) "\ "posting at %s() " \ "line #%d <%d>\n", (int) getpid(), (unsigned long long) \ @@ -420,7 +424,6 @@ union semun #a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ sem_post_SysV(a); }) # define sem_destroy(a) ({ int value; sem_getvalue(a, &value); \ - if (strstr(#a, "fork") != NULL) \ uprintf("[%d-%llu] Semaphore %s (%p) "\ "destroying at %s() " \ "line #%d <%d>\n", (int) getpid(), (unsigned long long) \ @@ -443,6 +446,13 @@ union semun # define sem_unlink(a) sem_unlink_SysV(a) #else # ifdef DEBUG_SEMAPHORES +# define sem_init(a, b, c) ({ \ + uprintf("[%d-%llu] Semaphore %s (%p) "\ + "initialization at %s() " \ + "line #%d <%d>\n", (int) getpid(), (unsigned long long) \ + pthread_self(), \ + #a, a, __FUNCTION__, __LINE__, c), fflush(stdout); \ + sem_init(a, b, c); }) # define sem_wait(a) ({ int value; sem_getvalue(a, &value); \ uprintf("[%d-%llu] Semaphore %s (%p) "\ "waiting at %s() " \ @@ -560,6 +570,7 @@ union semun __EXTERN__ pthread_mutex_t mutex_sigaction; __EXTERN__ pthread_mutex_t mutex_liste_threads; + __EXTERN__ pthread_mutex_t mutex_liste_threads_surveillance; __EXTERN__ pthread_mutex_t mutex_creation_variable_partagee __STATIC_MUTEX_INITIALIZATION__; __EXTERN__ pthread_mutex_t mutex_sections_critiques;