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 <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-03-27 09:21:09 +01:00
parent f0f76454c7
commit 774e52069d

View file

@ -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;