[Mingw-w64-public] Fwd: [patch] Reimplement GNU threads library on native Windows
Liu Hao
lh_mouse@126.com
Sat Jun 29 02:57:00 GMT 2019
在 2019/6/29 上午12:10, Jacek Caban 写道:
>
> You don't really need to store the whole __gthr_win32_thr_desc in TLS.
> If you stored just the handle, this wouldn't need a destructor.
>
>
The handle to be stored in the TLS ('the Handle' for short hereinafter)
should be a real handle, so there are a few scenarios that we should
consider:
0) the Handle should be closed upon the spawned thread's exit; in this
case a destructor is still necessary to prevent handle leaks.
1) the Handle is closed by the creator via either `*_join()` or
`*_detach()`; in the latter case the Handle becomes invalid while
the thread is running, so `*_self()` would return an invalid handle.
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.
--
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/20190629/211705c2/attachment.sig>
More information about the Libstdc++
mailing list