开发者

C++11 threading on Windows

开发者 https://www.devze.com 2023-03-21 22:37 出处:网络
Is there anyway to use std::thread with C++11 standard library in windows when compiling with g++ 4.5.2 in MinGW?

Is there anyway to use std::thread with C++11 standard library in windows when compiling with g++ 4.5.2 in MinGW?

I'开发者_如何学编程m going assume no as I've seen many things saying you have to compile with the pthreads option but I figure I'd ask anyway.


There is experimental support for std::thread in for MinGW-w64 toolchains.

Specifically, my GCC 4.6 builds provide usable std::thread through MinGW-w64's winpthreads library.

You can find downloads here:

  • 64-bit.
  • 32-bit.

Apart from that, MSVC11 (Visual Studio 2012) has <thread>, <chrono>, and <atomic>. You can download the Express edition here.


There is already a lightweight native implementation of std::thread and sync primitives: https://github.com/meganz/mingw-std-threads

IT is a header-only library and should work with any C++11 compliant version of MinGW. You just need to include the headers in your code.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号