Re: [PATCH v2 4/7] trace2: rename the thread_name argument to trace2_thread_start
- From
- Jeff Hostetler <git@jeffhostetler.com>
- Date
- Oct 20, 2022, 14:40 UTC
- Message-ID
- <27526718-7961-dc2c-946e-98757b3b36c8@jeffhostetler.com>
- In-Reply-To
- <221012.86edvcn3yc.gmgdl@evledraar.gmail.com>
On 10/12/22 5:06 PM, Ævar Arnfjörð Bjarmason wrote:
Show 48 quoted lines
>
> On Wed, Oct 12 2022, Jeff Hostetler via GitGitGadget wrote:
>
>> 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...
>
>> 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.
> good point. i'll split it and resend. thanks Jeff