Skip to content

Commit 405d097

Browse files
committed
improved debug print out
1 parent 2ec05c1 commit 405d097

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/util.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,15 @@ void _SEM_DESTROY_(sem_t *sem, const char *file, const char *func, int line,
143143
void _SEM_WAIT_(const char *file, const char *func, int line, sem_t *sem,
144144
const char *sem_name)
145145
{
146-
// log_printf(debug, file, func, line,
147-
// "%x sem_wait: %p, %s\n", pthread_self(), sem, sem_name);
146+
#ifdef DEBUG
148147
int j;
149-
sem_getvalue(sem, &j);
148+
if (sem_getvalue(sem, &j)) {
149+
log_printf(fatal, file, func, line,
150+
"%x sem_getvalue: %s\n", pthread_self(), strerror(errno));
151+
}
150152
log_printf(debug, file, func, line,
151153
"%x sem_wait: %p, %s, value: %d\n", pthread_self(), sem, sem_name, j);
154+
#endif
152155
int i;
153156
i = sem_wait(sem);
154157
if (i) {

0 commit comments

Comments
 (0)