diff options
author | U. Artie Eoff <ullysses.a.eoff@intel.com> | 2017-11-28 14:01:40 -0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2017-12-01 09:57:17 -0800 |
commit | 21704c3eeb99c818e2eeaa7cdb68958dbd12fcf7 (patch) | |
tree | 1a388fd4cde0ab605555225e0806514893d9ed3e | |
parent | df544cd5a31e54d4cbd33a391795a8747ddaf789 (diff) | |
download | libva-21704c3eeb99c818e2eeaa7cdb68958dbd12fcf7.tar.gz |
trace: init mutex before attempting to lock it
Call pthread_mutex_init before any calls to pthread_mutex_lock.
va_TraceInit(...) calls start_tracing2log_file(...) which
calls pthread_mutex_lock on the pva_trace->resource_mutex.
Thus, we need to ensure the mutex is initialized properly via
pthread_mutex_init before attempting to lock it.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
-rwxr-xr-x | va/va_trace.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/va/va_trace.c b/va/va_trace.c index 5e9d076..480ede3 100755 --- a/va/va_trace.c +++ b/va/va_trace.c @@ -743,6 +743,9 @@ void va_TraceInit(VADisplay dpy) pva_trace->dpy = dpy; + pthread_mutex_init(&pva_trace->resource_mutex, NULL); + pthread_mutex_init(&pva_trace->context_mutex, NULL); + if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) { pva_trace->fn_log_env = strdup(env_value); trace_ctx->plog_file = start_tracing2log_file(pva_trace); @@ -805,9 +808,6 @@ void va_TraceInit(VADisplay dpy) } } - pthread_mutex_init(&pva_trace->resource_mutex, NULL); - pthread_mutex_init(&pva_trace->context_mutex, NULL); - trace_ctx->trace_context = VA_INVALID_ID; pva_trace->ptra_ctx[MAX_TRACE_CTX_NUM] = trace_ctx; |