Commit c9c8e1c8 authored by Emil Velikov's avatar Emil Velikov Committed by Emil Velikov

c11/threads: rework Windows thrd_current() comment

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.

v2: Places brackets after function names (Eric)
Signed-off-by: default avatarEmil Velikov <>
Reviewed-by: Jose Fonseca <> (v1)
Reviewed-by: Eric Engestrom's avatarEric Engestrom <>
parent f258815c
......@@ -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()
* can be compared directly.
* Other potential solutions would be:
* - define thrd_t as a thread Ids, but this would mean we'd need to OpenThread for many operations
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment