[Development] thread_local: replacing GCC with Clang for MinGW

Thiago Macieira thiago.macieira at intel.com
Sun Aug 25 17:43:52 CEST 2019

On Sunday, 25 August 2019 00:44:51 PDT Olivier Goffart wrote:
> One could fix the leak by re-implementing DllMain in QtCore and using the
> DLL_THREAD_DETACH hook to delete the QAdoptedThread
> https://docs.microsoft.com/en-us/windows/win32/dlls/dllmain
> That would fix the leak for dynamic Qt build.
> But for static build we would need another trick.
> The comments from this file are pretty interesting and would provide a
> solution:
> https://github.com/rust-lang/rust/blob/master/src/libstd/sys/windows/thread
> _local.rs#L130

I'm not interested in further adding workarounds for compiler shortcomings 
that may be fixed in the very next release of those compilers when we already 
have a working solution.

People using std::thread are unlikely to be using QThreadStorage. If they have 
a problem with thread_local and want to use QThreadStorage, they can change 
the thread start too.

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products

More information about the Development mailing list