Re: [PATCH v2 4/7] trace2: rename the thread_name argument to trace2_thread_start
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Oct 12, 2022, 21:06 UTC
- Message-ID
- <221012.86edvcn3yc.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <637b422b8606b3b6d954e6a1959aae450507cdfa.1665600750.git.gitgitgadget@gmail.com>
On Wed, Oct 12 2022, Jeff Hostetler via GitGitGadget wrote:
Show 9 quoted lines
> From: Jeff Hostetler <jeffhost@microsoft.com> > > 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...
Show 23 quoted lines
> 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.