Home > Article > Backend Development > Does MinGW-w64 with Win32 Threading Model Support `std::thread` Out of the Box?
Does MinGW-w64 Support std::thread with Win32 Threading?
You recently configured MinGW-w64 with the Win32 threading model, anticipating enhanced performance. However, your attempts to utilize std::thread in your code have proven futile. Let's clarify the situation:
According to user rubenvb, std::thread support should be available regardless of the threading model selected during installation. However, your experience suggests otherwise.
To resolve the confusion, consider these possibilities:
It's important to emphasize that third-party libraries like mingw-std-threads are excluded from this inquiry, as they don't fall within the "out of the box" criterion. Therefore, let's focus on the fundamental question:
Does MinGW-w64 natively support code that utilizes std::thread when configured with the Win32 internal threading model?
The answer, based on available information, is:
To enable std::thread with MinGW-w64 under the Win32 threading model, consider installing the mingw-std-threads headers. This disparity stems from the absence of native thread support in GCC, which relies on external libraries like glibc for thread implementation. Since MinGW-w64 does not include glibc, you'll need to employ alternative headers to make std::thread functional.
The above is the detailed content of Does MinGW-w64 with Win32 Threading Model Support `std::thread` Out of the Box?. For more information, please follow other related articles on the PHP Chinese website!