[Issue 20680] core.thread.Thread leaks OS handle when not joined

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 17 17:36:18 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=20680

--- Comment #3 from Tomáš Chaloupka <chalucha at gmail.com> ---
(In reply to Steven Schveighoffer from comment #2)
> When linking to github, use the `y` command to change the link to a
> hash-based link, otherwise your links get stale. 
> 
> For reference, here are the two links:
> 
> https://github.com/dlang/druntime/blob/
> 19ef6336d1940e770d696dc71f7605eb3f618a85/src/core/thread/osthread.d#L304
> https://github.com/dlang/druntime/blob/
> 19ef6336d1940e770d696dc71f7605eb3f618a85/src/core/thread/osthread.d#L697
> 
> Can you test again? the code has changed quite a bit since then, the
> destructor looks rewritten.

Yes I can still confirm it on both windows and linux.
Tried with dmd-2.098.0 on windows and build from current master on linux.

Added some logging to the Thread destructor with the output:

```D
press enter to start

~Thread()
~Thread()
~Thread()
~Thread()
~Thread()
~Thread()
~Thread()
~Thread()
~Thread()
~Thread()
threads disposed, press enter to exit

~Thread()
passed
detach
```

So currently, it won't pass this
https://github.com/dlang/druntime/blob/abd43eb4e760667fc4b1ebe1fe07d29340265596/src/core/thread/osthread.d#L292

And sorry for not permanent links, younger me hasn't known all he knows now ;-)

--


More information about the Digitalmars-d-bugs mailing list