C++11 threading on Windows

前端 未结 2 843
醉梦人生
醉梦人生 2020-12-19 02:25

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 man

相关标签:
2条回答
  • 2020-12-19 02:41

    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 讨论(0)
  • 2020-12-19 02:50

    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.

    0 讨论(0)
提交回复
热议问题