summaryrefslogtreecommitdiff
path: root/src/KM_log.cpp
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2008-08-09 01:09:50 +0000
committerjhurst <>2008-08-09 01:09:50 +0000
commit4e404673b69a7e2772579788a0b55c7037cee314 (patch)
treed6f05d45f382506786ba737adaa254433d1abb97 /src/KM_log.cpp
parent7827a7e7572601440568788cb028ee883498fa15 (diff)
The following changes have been checked into napali:
1. The is some template voodoo in KM_fileio.h to ward off the D_FILE_OFFSET_BITS=64 bug 2. KM_log.cpp now uses mutex protection for the global default LogSink 3. I added Kumu::Version (uses the same value as ASDCP::Version()). I did this because... 4. I modified Makefile.am so that kmfilegen, kmrandgen, and kmuuidgen only link against libkumu, as nature intended.
Diffstat (limited to 'src/KM_log.cpp')
-rwxr-xr-xsrc/KM_log.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/KM_log.cpp b/src/KM_log.cpp
index aa0303b..3d34f1c 100755
--- a/src/KM_log.cpp
+++ b/src/KM_log.cpp
@@ -31,6 +31,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <KM_util.h>
#include <KM_log.h>
+#include <KM_mutex.h>
#include <sys/types.h>
#include <string.h>
#include <stdarg.h>
@@ -58,20 +59,24 @@ Kumu::ILogSink::vLogf(LogType_t type, const char* fmt, va_list* list)
//------------------------------------------------------------------------------------------
//
-static Kumu::ILogSink* s_DefaultLogSink;
+static Kumu::Mutex s_DefaultLogSinkLock;
+static Kumu::ILogSink* s_DefaultLogSink = 0;
static Kumu::StdioLogSink s_StderrLogSink;
//
void
Kumu::SetDefaultLogSink(ILogSink* Sink)
{
- s_DefaultLogSink = Sink;
+ AutoMutex L(s_DefaultLogSinkLock);
+ s_DefaultLogSink = Sink;
}
// Returns the internal default sink.
Kumu::ILogSink&
Kumu::DefaultLogSink()
{
+ AutoMutex L(s_DefaultLogSinkLock);
+
if ( s_DefaultLogSink == 0 )
s_DefaultLogSink = &s_StderrLogSink;