[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    Re: [Mingw-w64-public] Fwd: [patch] Reimplement GNU threads library on native Windows
From:       Liu Hao <lh_mouse () 126 ! com>
Date:       2019-06-29 2:56:28
Message-ID: 715159ed-1f9b-768e-8ac1-130d0dcbbfd1 () 126 ! com
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


在 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


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic