Skip to content

Commit 3124793

Browse files
jeffhostetlergitster
authored andcommitted
trace2: improve thread-name documentation in the thread-context
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a70839c commit 3124793

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

trace2/tr2_tls.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ struct tr2tls_thread_ctx {
2525
/*
2626
* Create thread-local storage for the current thread.
2727
*
28-
* We assume the first thread is "main". Other threads are given
29-
* non-zero thread-ids to help distinguish messages from concurrent
30-
* threads.
31-
*
32-
* Truncate the thread name if necessary to help with column alignment
33-
* in printf-style messages.
28+
* The first thread in the process will have:
29+
* { .thread_id=0, .thread_name="main" }
30+
* Subsequent threads are given a non-zero thread_id and a thread_name
31+
* constructed from the id and a thread base name (which is usually just
32+
* the name of the thread-proc function). For example:
33+
* { .thread_id=10, .thread_name="th10:fsm-listen" }
34+
* This helps to identify and distinguish messages from concurrent threads.
35+
* The ctx.thread_name field is truncated if necessary to help with column
36+
* alignment in printf-style messages.
3437
*
3538
* In this and all following functions the term "self" refers to the
3639
* current thread.

0 commit comments

Comments
 (0)