diff -r 89fec8668768 -r a6413a3d741d include/common.h --- a/include/common.h Fri Mar 28 21:47:32 2008 +0100 +++ b/include/common.h Fri Mar 28 23:30:04 2008 +0100 @@ -30,6 +30,7 @@ #include #include #include +#include #ifdef PYRIT_DOUBLE # define Float double @@ -46,20 +47,27 @@ 1: major status messages (*) 2: minor status, progress (-) 3: debug messages (D) -4: more debug +4: thread debug default = 2 */ extern int pyrit_verbosity; inline void dbgmsg(const int vlevel, const char *format, ...) { + static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; if (pyrit_verbosity >= vlevel) { + if (pyrit_verbosity >= 4) + pthread_mutex_lock(&mutex); + va_list ap; va_start(ap, format); vprintf(format, ap); va_end(ap); fflush(stdout); + + if (pyrit_verbosity >= 4) + pthread_mutex_unlock(&mutex); } }