[Mingw-w64-public] Fwd: [patch] Reimplement GNU threads library on native Windows
Liu Hao
lh_mouse@126.com
Tue Jul 2 09:57:00 GMT 2019
在 2019/7/2 下午5:19, Eric Botcazou 写道:
>> It seems inappropriate to use handles as thread identifiers (as handles
>> imply resource ownership and are not unique identifiers); thread IDs (as
>> `DWORD` or `unsigned long`) would be a better alternative.
>
> This was considered but ultimately rejected, as you can do nothing with a
> thread Id, i.e. you need a handle for everything. But the __gthread_equal
> routine does compare the Ids and not the handles.
>
The `OpenThread()` function can obtain a handle by thread ID. It returns
a real handle that has to be closed when it is out of use. Using the
pseudo handle returned by `GetCurrentThread()` may be more efficient if
the target thread ID is equal to `GetCurrentThreadId()`.
--
Best regards,
LH_Mouse
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20190702/797b4244/attachment.sig>
More information about the Libstdc++
mailing list