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:
		
							parent
							
								
									cb0d1a9e50
								
							
						
					
					
						commit
						dc0ebb55ff
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
					@ -172,6 +172,7 @@ static uint32_t create_thread_wrapper (void *ptr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  uint32_t ret;
 | 
					  uint32_t ret;
 | 
				
			||||||
  struct thread_context *ctx = ptr;
 | 
					  struct thread_context *ctx = ptr;
 | 
				
			||||||
 | 
					  DDS_TRACE ("started new thread %"PRIdTID": %s\n", ddsrt_gettid (), ctx->self->name);
 | 
				
			||||||
  ctx->self->tid = ddsrt_thread_self ();
 | 
					  ctx->self->tid = ddsrt_thread_self ();
 | 
				
			||||||
  ret = ctx->f (ctx->arg);
 | 
					  ret = ctx->f (ctx->arg);
 | 
				
			||||||
  ddsrt_free (ctx);
 | 
					  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);
 | 
					    DDS_FATAL("create_thread: %s: ddsrt_thread_create failed\n", name);
 | 
				
			||||||
    goto fatal;
 | 
					    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 */
 | 
					  ts1->extTid = tid; /* overwrite the temporary value with the correct external one */
 | 
				
			||||||
  ddsrt_mutex_unlock (&thread_states.lock);
 | 
					  ddsrt_mutex_unlock (&thread_states.lock);
 | 
				
			||||||
  return ts1;
 | 
					  return ts1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue