From d654b817f2bdb80102dd663d78f31ab3eea4f6bd Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 28 May 2015 13:51:54 +0200 Subject: [PATCH 1/1] Add lock/unlock for YAZ log writes YAZ-843 --- include/yaz/log.h | 7 +++++++ src/log.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/yaz/log.h b/include/yaz/log.h index 57bad18..9268287 100644 --- a/include/yaz/log.h +++ b/include/yaz/log.h @@ -220,6 +220,13 @@ YAZ_EXPORT void log_event_end(void (*func)(int level, const char *msg, */ YAZ_EXPORT void yaz_log_xml_errors(const char *prefix, int log_level); +/** \brief Lock for YAZ log writes +*/ +YAZ_EXPORT void yaz_log_lock(void); + +/** \brief Unlock for YAZ log writes +*/ +YAZ_EXPORT void yaz_log_unlock(void); YAZ_END_CDECL #endif diff --git a/src/log.c b/src/log.c index bbaf4fb..8bc5ad0 100644 --- a/src/log.c +++ b/src/log.c @@ -105,12 +105,12 @@ static unsigned int next_log_bit = YLOG_LAST_BIT<<1; /* first dynamic bit */ static YAZ_MUTEX log_mutex = 0; -static void yaz_log_lock(void) +void yaz_log_lock(void) { yaz_mutex_enter(log_mutex); } -static void yaz_log_unlock(void) +void yaz_log_unlock(void) { yaz_mutex_leave(log_mutex); } -- 1.7.10.4