[Mesa-dev] [PATCH] c11/threads: rework Windows thrd_current() comment
Emil Velikov
emil.l.velikov at gmail.com
Thu May 4 17:14:08 UTC 2017
On 2 May 2017 at 11:23, Eric Engestrom <eric.engestrom at imgtec.com> wrote:
> On Saturday, 2017-04-29 14:51:15 +0100, Emil Velikov wrote:
>> From: Emil Velikov <emil.velikov at collabora.com>
>>
>> Drop the misleading "will not match the one returned by thread_create"
>> hunk and provide more clarity as to what/why GetCurrentThread() isn't
>> the solution we're looking for.
>>
>> Cc: José Fonseca <jfonseca at vmware.com>
>> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
>> ---
>> include/c11/threads_win32.h | 10 +++++++---
>> 1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/c11/threads_win32.h b/include/c11/threads_win32.h
>> index d017c31c34e..7ffd3ae3a23 100644
>> --- a/include/c11/threads_win32.h
>> +++ b/include/c11/threads_win32.h
>> @@ -502,9 +502,13 @@ thrd_current(void)
>> HANDLE hCurrentThread;
>> BOOL bRet;
>>
>> - /* GetCurrentThread() returns a pseudo-handle, which is useless. We need
>> - * to call DuplicateHandle to get a real handle. However the handle value
>> - * will not match the one returned by thread_create.
>> + /* GetCurrentThread() returns a pseudo-handle, which we need
>> + * to pass to DuplicateHandle. Only the resulting handle can be used
>> + * from other threads.
>> + *
>> + * Note that neither handle can be compared to the one by thread_create.
>> + * Only the thread IDs - as returned by GetThreadId and GetCurrentThreadId
>
> nit: `GetThreadId()` & `GetCurrentThreadId()` (with parentheses) for consistency?
>
^^ + added a pair after DuplicateHandle and pushed to master.
> Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
>
Thanks
Emil
More information about the mesa-dev
mailing list