summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wrapper/verbose.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wrapper/verbose.h b/src/wrapper/verbose.h
index 719edc7..06ee681 100644
--- a/src/wrapper/verbose.h
+++ b/src/wrapper/verbose.h
@@ -1,15 +1,21 @@
#pragma once
#ifdef VERBOSE_FUNCTIONS
+# include <stdio.h>
# include <stdarg.h>
+# include <pthread.h>
static void
verbose(const char *fmt, ...)
{
+ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&mutex);
+ fprintf(stderr, "%lu: ", pthread_self());
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
fputc('\n', stderr);
+ pthread_mutex_unlock(&mutex);
}
#else
# define verbose(...)