Home > Backend Development > C++ > body text

Does MinGW-w64 with Win32 Threading Model Support `std::thread`?

Barbara Streisand
Release: 2024-11-02 22:47:29
Original
438 people have browsed it

Does MinGW-w64 with Win32 Threading Model Support `std::thread`?

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template