Does MinGW-w64 natively support std::thread with Win32 threading model?
When using the MinGW-w64 toolchain, selecting the Win32 threading model may raise concerns about the availability of C 11 thread support.
Initially, it was believed that std::thread could be used regardless of the threading model based on previous statements. However, that assumption proved incorrect.
Despite invoking g with -std=c 11, std::thread remains unsupported. The options to reconcile this discrepancy are:
However, the "out of the box" qualification in the question excludes third-party options like mingw-std-threads.
Native std::thread Support
As of May 2016, native std::thread support in MinGW-w64 with the Win32 threading model is achieved by installing the mingw-std-threads headers.
This is because MinGW-w64 lacks native thread support like other GCC installations that implement threading via gthreads or pthreads. MinGW-w64 also lacks a glibc port but uses MSVC runtime and its own code to fill in missing components.
Recent versions of MinGW-w64 include a Win32 port of pthreads ("winpthreads"), which explains why selecting the "pthread" model during installation enables threads.
The above is the detailed content of Does MinGW-w64 with the Win32 threading model support std::thread natively?. For more information, please follow other related articles on the PHP Chinese website!