MinGW-w64 and std::thread with Win32 Threading Model
Despite configuring MinGW-w64 with the Win32 threading model, you may encounter issues utilizing C 11 threads as std::thread support seems unavailable.
Originally, it was assumed that choosing the Win32 threading model would impact only GCC's internal operations and not prevent thread usage. However, this appears to be incorrect.
As noted by a community member, MinGW-w64 lacks native thread support and relies on external libraries such as gthreads or pthreads to implement threading. These libraries are typically found in glibc, which MinGW-w64 does not include.
To address this limitation, MinGW-w64 offers a third-party library called mingw-std-threads. However, this does not fall under the "out of the box" support as requested.
Therefore, as of May 2016, MinGW-w64 does not natively support std::thread in code that relies on the C 11 thread library when installed with the Win32 threading model. To overcome this, one can consider installing mingw-std-threads or selecting the "pthread" model during MinGW-w64 installation.
The above is the detailed content of Does MinGW-w64 with Win32 Threading Model Support `std::thread`?. For more information, please follow other related articles on the PHP Chinese website!