--- rpl/src/rpl.h 2019/02/06 14:23:26 1.327 +++ rpl/src/rpl.h 2019/02/09 13:36:43 1.329 @@ -395,20 +395,36 @@ union semun #ifdef IPCS_SYSV # ifdef DEBUG_SEMAPHORES # 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\ pthread_self(), \ #a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ sem_wait_SysV(a); }) -# define sem_post(a) ({ int value; sem_getvalue(a, &value); \ +# 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\ + pthread_self(), \ + #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) \ pthread_self(), \ #a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ sem_post_SysV(a); }) -# define sem_destroy(a) ({ int value; sem_getvalue(a, &value); \ +# 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) \ + pthread_self(), \ + #a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ if (value == 0) BUG(1, uprintf("Value %d\n", value)); \ sem_destroy_SysV(a); }) # else @@ -433,6 +449,13 @@ union semun pthread_self(), \ #a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ sem_wait(a); }) +# define sem_trywait(a) ({ int value; sem_getvalue(a, &value); \ + uprintf("[%d-%llu] Semaphore %s (%p) "\ + "trywaiting at %s() " \ + "line #%d <%d>\n", (int) getpid(), (unsigned long long) \ + pthread_self(), \ + #a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ + sem_trywait(a); }) # define sem_post(a) ({ int value; sem_getvalue(a, &value); \ uprintf("[%d-%llu] Semaphore %s (%p) "\ "posting at %s() " \ @@ -441,6 +464,11 @@ union semun #a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ sem_post(a); }) # define sem_destroy(a) ({ int value; sem_getvalue(a, &value); \ + uprintf("[%d-%llu] Semaphore %s (%p) "\ + "destroying at %s() " \ + "line #%d <%d>\n", (int) getpid(), (unsigned long long) \ + pthread_self(), \ + #a, a, __FUNCTION__, __LINE__, value), fflush(stdout); \ if (value == 0) BUG(1, uprintf("Value %d\n", value)); \ sem_destroy(a); }) # endif @@ -3282,7 +3310,8 @@ int envoi_signal_contexte(struct_process enum signaux_rpl signal); int envoi_signal_processus(pid_t pid, enum signaux_rpl signal, logical1 test_ouverture); -int envoi_signal_thread(pthread_t tid, enum signaux_rpl signal); +int envoi_signal_thread(struct_processus *s_etat_processus, + pthread_t tid, enum signaux_rpl signal); #endif /*