From 8272eab1f800eaa276166d9b75fd259e1a1b408c Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 23 Mar 2010 12:31:20 +0100 Subject: [PATCH] Debugging level "mutex" enables log mutexes --- src/pazpar2.c | 3 +-- src/ppmutex.c | 11 +++++------ src/ppmutex.h | 4 +--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/pazpar2.c b/src/pazpar2.c index 4e4b1ef..cb69a5e 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -171,8 +171,7 @@ static int sc_main( yaz_log(YLOG_FATAL, "Configuration must be given with option -f"); return 1; } - if (global_parameters.debug_mode > 1) - pazpar2_mutex_enable_debug(1); + pazpar2_mutex_init(); config = config_create(config_fname, global_parameters.dump_records); if (!config) diff --git a/src/ppmutex.c b/src/ppmutex.c index fa187b2..c389db4 100644 --- a/src/ppmutex.c +++ b/src/ppmutex.c @@ -26,22 +26,21 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #endif #include - +#include #include "ppmutex.h" -static int pazpar2_mutex_debug = 0; +static int ppmutex_level = 0; -void pazpar2_mutex_enable_debug(int debug) +void pazpar2_mutex_init(void) { - pazpar2_mutex_debug = debug; + ppmutex_level = yaz_log_module_level("mutex"); } void pazpar2_mutex_create(YAZ_MUTEX *p, const char *name) { assert(p); yaz_mutex_create(p); - if (pazpar2_mutex_debug && name) - yaz_mutex_set_name(*p, name); + yaz_mutex_set_name(*p, ppmutex_level, name); } /* diff --git a/src/ppmutex.h b/src/ppmutex.h index c6b8c9e..d924e7f 100644 --- a/src/ppmutex.h +++ b/src/ppmutex.h @@ -26,10 +26,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include -YAZ_EXPORT -void pazpar2_mutex_enable_debug(int debug); +void pazpar2_mutex_init(void); -YAZ_EXPORT void pazpar2_mutex_create(YAZ_MUTEX *p, const char *name); #endif -- 1.7.10.4