On Wed, Oct 12 2022, Jeff Hostetler via GitGitGadget wrote: > From: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx> > > Rename the `thread_name` argument in `tr2tls_create_self()` and > `trace2_thread_start()` to be `thread_base_name` to make it clearer > that the passed argument is a component used in the construction of > the actual `struct tr2tls_thread_ctx.thread_name` variable. > > The base name will be used along with the thread id to create a > unique thread name. Makes sense. > This commit does not change how the `thread_name` field is > allocated or stored within the `tr2tls_thread_ctx` structure. What this commit does change though, which isn't mentioned here, is... > diff --git a/trace2/tr2_tls.h b/trace2/tr2_tls.h > index 1297509fd23..7d1f03a2ea6 100644 > --- a/trace2/tr2_tls.h > +++ b/trace2/tr2_tls.h > @@ -25,17 +25,20 @@ 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="th10fsm-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. ...this documentation, which I'd argue should be a separate change, as nothing's changed about the state of the world with this rename of the field, this was all true before this rename.