Skip to content

Commit

Permalink
trace2: improve thread-name documentation in the thread-context
Browse files Browse the repository at this point in the history
Improve the documentation of the tr2tls_thread_ctx.thread_name field
and its relation to the tr2tls_thread_ctx.thread_id field.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
jeffhostetler authored and gitster committed Oct 24, 2022
1 parent a70839c commit 3124793
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions trace2/tr2_tls.h
Expand Up @@ -25,12 +25,15 @@ struct tr2tls_thread_ctx {
/*
* Create thread-local storage for the current thread.
*
* We assume the first thread is "main". Other threads are given
* non-zero thread-ids to help distinguish messages from concurrent
* threads.
*
* Truncate the thread name if necessary to help with column alignment
* in printf-style messages.
* The first thread in the process will have:
* { .thread_id=0, .thread_name="main" }
* Subsequent threads are given a non-zero thread_id and a thread_name
* constructed from the id and a thread base name (which is usually just
* the name of the thread-proc function). For example:
* { .thread_id=10, .thread_name="th10:fsm-listen" }
* This helps to identify and distinguish messages from concurrent threads.
* The ctx.thread_name field is truncated if necessary to help with column
* alignment in printf-style messages.
*
* In this and all following functions the term "self" refers to the
* current thread.
Expand Down

0 comments on commit 3124793

Please sign in to comment.