Commit 8d9c9775 authored by James Almer's avatar James Almer

avutil/log: use thread wrappers for the locking functionality

w32threads and os2threads both support static mutex initialization now,
so don't limit it to pthreads only.
Reviewed-by: 's avatarwm4 <nfxjfg@googlemail.com>
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 414a49d6
...@@ -39,11 +39,9 @@ ...@@ -39,11 +39,9 @@
#include "common.h" #include "common.h"
#include "internal.h" #include "internal.h"
#include "log.h" #include "log.h"
#include "thread.h"
#if HAVE_PTHREADS static AVMutex mutex = AV_MUTEX_INITIALIZER;
#include <pthread.h>
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
#define LINE_SZ 1024 #define LINE_SZ 1024
...@@ -317,9 +315,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) ...@@ -317,9 +315,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
if (level > av_log_level) if (level > av_log_level)
return; return;
#if HAVE_PTHREADS ff_mutex_lock(&mutex);
pthread_mutex_lock(&mutex);
#endif
format_line(ptr, level, fmt, vl, part, &print_prefix, type); format_line(ptr, level, fmt, vl, part, &print_prefix, type);
snprintf(line, sizeof(line), "%s%s%s%s", part[0].str, part[1].str, part[2].str, part[3].str); snprintf(line, sizeof(line), "%s%s%s%s", part[0].str, part[1].str, part[2].str, part[3].str);
...@@ -356,9 +352,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) ...@@ -356,9 +352,7 @@ void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
#endif #endif
end: end:
av_bprint_finalize(part+3, NULL); av_bprint_finalize(part+3, NULL);
#if HAVE_PTHREADS ff_mutex_unlock(&mutex);
pthread_mutex_unlock(&mutex);
#endif
} }
static void (*av_log_callback)(void*, int, const char*, va_list) = static void (*av_log_callback)(void*, int, const char*, va_list) =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment