summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEmil Velikov <emil.velikov@collabora.com>2017-04-29 14:46:02 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2017-05-04 18:00:23 +0100
commitc9c8e1c84d776c23e0ea3e051a97a9c7f7d80c15 (patch)
tree2d95ab40a194d246b420f1a95ccb758bbed6e019 /include
parentf258815c7d4187fd83f6944943e78206a6cdc4cb (diff)
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: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com> (v1) Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Diffstat (limited to 'include')
-rw-r--r--include/c11/threads_win32.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/c11/threads_win32.h b/include/c11/threads_win32.h
index d017c31c34..af7df4b9ef 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()
+ * 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