From: Adam Dickmeiss Date: Thu, 28 May 2015 11:49:16 +0000 (+0200) Subject: Fix race condition in MP log output MP-522 X-Git-Tag: v1.8.9~4 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=ef7c799c8f8a02e625f6891537b50ba2459cc99e;p=metaproxy-moved-to-github.git Fix race condition in MP log output MP-522 --- diff --git a/src/filter_log.cpp b/src/filter_log.cpp index 4db9942..27ebadb 100644 --- a/src/filter_log.cpp +++ b/src/filter_log.cpp @@ -681,7 +681,11 @@ void yf::Log::Impl::process(mp::Package &package) { mp::odr odr(ODR_PRINT); odr_set_stream(odr, m_file->fhandle, stream_write, 0); + if (!m_file->fhandle) + yaz_log_lock(); z_GDU(odr, &gdu_req, 0, 0); + if (!m_file->fhandle) + yaz_log_unlock(); } } } @@ -776,7 +780,11 @@ void yf::Log::Impl::process(mp::Package &package) { mp::odr odr(ODR_PRINT); odr_set_stream(odr, m_file->fhandle, stream_write, 0); + if (!m_file->fhandle) + yaz_log_lock(); z_GDU(odr, &gdu_res, 0, 0); + if (!m_file->fhandle) + yaz_log_unlock(); } } }