From e0e5d5014e84c10d3270afc9700a69c867ed282d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 8 Apr 2009 16:24:31 +0100 Subject: trace: Make calls dumping threadsafe. --- src/gallium/drivers/trace/tr_dump.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index f9ee7876cb..2618883e70 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -45,6 +45,7 @@ #endif #include "pipe/p_compiler.h" +#include "pipe/p_thread.h" #include "util/u_debug.h" #include "util/u_memory.h" #include "util/u_string.h" @@ -58,6 +59,7 @@ static struct util_stream *stream = NULL; static unsigned refcount = 0; +static pipe_mutex call_mutex; static long unsigned call_no = 0; @@ -220,6 +222,7 @@ trace_dump_trace_close(void) stream = NULL; refcount = 0; call_no = 0; + pipe_mutex_destroy(call_mutex); } } @@ -237,6 +240,8 @@ boolean trace_dump_trace_begin() if(!stream) return FALSE; + pipe_mutex_init(call_mutex); + trace_dump_writes("\n"); trace_dump_writes("\n"); trace_dump_writes("\n"); @@ -267,6 +272,7 @@ void trace_dump_trace_end(void) void trace_dump_call_begin(const char *klass, const char *method) { + pipe_mutex_lock(call_mutex); ++call_no; trace_dump_indent(1); trace_dump_writes("