diff options
author | Jeff Hostetler <jeffhost@microsoft.com> | 2022-10-24 16:41:04 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-10-24 22:45:25 +0300 |
commit | 31247936041318d441de5a2681f9bcb79459c726 (patch) | |
tree | 7f69e78554c193b0479b12b6927c9f6e22b6e474 /trace2 | |
parent | a70839cf36c9cad10e514f75fa1bec2e6180dbda (diff) |
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 <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trace2')
-rw-r--r-- | trace2/tr2_tls.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/trace2/tr2_tls.h b/trace2/tr2_tls.h index d4e725f430..3ac4380d82 100644 --- a/trace2/tr2_tls.h +++ b/trace2/tr2_tls.h @@ -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. |