LIU Hao wrote:

> I think I have found a bug in winpthreads:
>
> ...
>
> The DLL calls `pthread_setspecific()`, which calls `__pthread_self_lite()`, 
> which happens before
> `pthread_create_wrapper()` begins execution, so the current thread doesn't 
> have a pthread structure yet.
> In this case `__pthread_self_lite()` allocates a blank structure and assigns 
> a pointer to `_pthread_tls`,
> which is later overwritten by `pthread_create_wrapper()`. The previous 
> structure leaks, along with the
> event handle, the thread handle, and all TLS keys.
>
> The Microsoft threads DLL doesn't seem to be affected; but linking their 
> static CRT causes assertion
> failures when `tss_set()` is called from `DllMain()`.

I recall seeing on bug-gnulib a few mentions of an issue with winpthreads' 
`pthread_{get,set}specific` functions. I'm not sure if this is the same issue 
though.

I want to look more closely at thread.c after I'm done cleaning up/updating 
other, smaller, source files. If anyone wants to look into this particular 
issue in the meantime, feel free.

- Kirill Makurin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to