From 774e52069daefce305ccd205a827cfc7e0bf383b Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Wed, 27 Mar 2019 09:21:09 +0100 Subject: [PATCH] trace correct thread id during thread creation The rewrite of the abstraction layer changed some details in thread ids used in tracing and functions to get those ids, with a result of always printing the parent thread's id in create_thread rather than the newly create thread's id. As all supported platforms use thread names in the trace, it is a rather insignificant matter, and so this provides the trivial fix by letting the new thread log the message. Signed-off-by: Erik Boasson --- src/core/ddsi/src/q_thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ddsi/src/q_thread.c b/src/core/ddsi/src/q_thread.c index cadbb6e..4d3fe45 100644 --- a/src/core/ddsi/src/q_thread.c +++ b/src/core/ddsi/src/q_thread.c @@ -172,6 +172,7 @@ static uint32_t create_thread_wrapper (void *ptr) { uint32_t ret; struct thread_context *ctx = ptr; + DDS_TRACE ("started new thread %"PRIdTID": %s\n", ddsrt_gettid (), ctx->self->name); ctx->self->tid = ddsrt_thread_self (); ret = ctx->f (ctx->arg); ddsrt_free (ctx); @@ -272,7 +273,6 @@ struct thread_state1 *create_thread (const char *name, uint32_t (*f) (void *arg) DDS_FATAL("create_thread: %s: ddsrt_thread_create failed\n", name); goto fatal; } - DDS_TRACE("started new thread %"PRIdTID" : %s\n", ddsrt_gettid(), name); ts1->extTid = tid; /* overwrite the temporary value with the correct external one */ ddsrt_mutex_unlock (&thread_states.lock); return ts1;