fix leaking thread handles on Windows#3147
Conversation
On Windows, thread handle should be closed explicitly. Co-authored-by: luben karavelov <luben@users.noreply.github.com>
|
Great find @animalize ! cc @terrelln |
|
On Windows, threads are created by Line 51 in 9a5e73c There is another review resource in the MSDN page of
So no need to call
Zstd is using |
|
Thanks for the fix @animalize! |
Fix #3051. On Windows, thread handles should be closed explicitly.
ZSTD_pthread_join()function is called when shuting down the threads queue, so no need to setthread.handleto 0._beginthreadex()function, there is an example at the bottom of this MSDN page that matches zstd code.A Python reproduce code (with pyzstd module), it uses 12 threads to compress
INPUTfile:Reproduce code output. Before this PR, it leaks 12 handles per round: