From: Adam Dickmeiss Date: Thu, 28 May 2015 11:51:54 +0000 (+0200) Subject: Add lock/unlock for YAZ log writes YAZ-843 X-Git-Tag: v5.13.0~2 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=d654b817f2bdb80102dd663d78f31ab3eea4f6bd;p=yaz-moved-to-github.git Add lock/unlock for YAZ log writes YAZ-843 --- 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); }