久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 Win32 線程模型時,MinGW-w64 是否支持 std::th

Does MinGW-w64 support std::thread out of the box when using the Win32 threading model?(使用 Win32 線程模型時,MinGW-w64 是否支持 std::thread 開箱即用?)
本文介紹了使用 Win32 線程模型時,MinGW-w64 是否支持 std::thread 開箱即用?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在安裝 MinGW-w64 工具鏈時選擇了 Win32 線程模型,在閱讀它之后,它提供了比 POSIX 對應的更好的性能.我自己沒有資格對此聲明進行基準測試,但是 這里是它的來源.

I have opted for the Win32 threading model when installing the MinGW-w64 toolchain, after reading that it provides better performance than the POSIX counterpart. I am not qualified for benchmarking this claim myself, but here's a source for it.

起初我認為這個選項只會影響 GCC 運行時的內部工作,而不會阻止我在我的代碼中使用 C++11 線程,基于 此答案 和此評論 來自其他用戶 rubenvb.
然而,情況似乎并非如此.std::thread 在此 MinGW-w64 安裝中似乎不存在支持.

At first I thought this option would only affect the inner workings of the GCC runtime, while not preventing me from using C++11 threads in my code, based on this answer and this comment by fellow user rubenvb.
However, this doesn't seem to be the case. std::thread support appears to be non-existent in this MinGW-w64 installation.

我正在從命令行調用 g++,除了 -std=c++11 之外沒有其他選項.

I am invoking g++ from the command line with no options other than -std=c++11.

此時我不確定:

  • rubenvb 搞錯了,為了編譯我的代碼依賴于C++11thread,實際上需要在POSIX線程模型下安裝MinGW-w64圖書館,或;
  • 我完全誤解了這一切,或者;
  • std::thread 實際上在我的場景中是支持的,只是不直觀.
  • rubenvb was mistaken, and it's actually necessary to install MinGW-w64 under the POSIX threading model in order to compile my code which depends on the C++11 thread library, or;
  • I completely misunderstood it all, or;
  • std::thread is actually supported in my scenario, it's just not intuitive.

我加強了標題中的開箱即用"部分.存在一個名為 mingw-std-threads 的庫,如 這個答案.但是,作為第三方選項,與此問題無關.

I reinforce the "out of the box" part in the title. There exists a library called mingw-std-threads, as presented in this answer. However, as a third-party option, it is not relevant to this question.

那么,截至今天(2016 年 5 月),當與 Win32 內部線程模型一起安裝時,MinGW-w64 是否本身支持 std::thread 依賴代碼?

So, as of today (May 2016), does MinGW-w64 nativelly support std::thread depending code, when installed with the Win32 internal threading model?

推薦答案

要將 MinGW-w64 與 Win32 本機線程一起使用,您可以安裝 mingw-std-threads 頭.

To use the MinGW-w64 with Win32 native threads you can install the mingw-std-threads headers.

如該頁面所述,這是因為 MinGW-w64 是 GCC 的一個端口,但 GCC 不包含任何本機線程支持.相反,GCC 安裝通常通過 gthreads 或 pthreads 作為 glibc 的一部分來實現線程.MinGW-w64 不包含 glibc 的端口.(相反,它結合使用了 MSVC 運行時加上自己的代碼來填補漏洞).

As described on that page, this is because MinGW-w64 is a port of GCC, but GCC does not include any native thread support. Instead GCC installations typically implement threading via either gthreads or pthreads as a part of glibc. MinGW-w64 does not include a port of glibc. (Instead it uses a combination of the MSVC runtime, plus its own code to fill in holes).

同樣如該頁面所述,MinGW-w64 的最新版本確實包含 pthreads 的 Win32 端口(winpthreads"),這解釋了為什么您可以通過選擇pthread"模型讓線程開箱即用"工作來自 MinGW-w64 安裝程序.

Also as described on that page, recent versions of MinGW-w64 do include a Win32 port of pthreads ("winpthreads"), which explains why you can have threads work "out of the box" by selecting the "pthread" model from the MinGW-w64 installer.

這篇關于使用 Win32 線程模型時,MinGW-w64 是否支持 std::thread 開箱即用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

What is the fastest way to transpose a matrix in C++?(在 C++ 中轉置矩陣的最快方法是什么?)
Sorting zipped (locked) containers in C++ using boost or the STL(使用 boost 或 STL 在 C++ 中對壓縮(鎖定)容器進行排序)
Rotating a point about another point (2D)(圍繞另一個點旋轉一個點 (2D))
Image Processing: Algorithm Improvement for #39;Coca-Cola Can#39; Recognition(圖像處理:Coca-Cola Can 識別的算法改進)
How do I construct an ISO 8601 datetime in C++?(如何在 C++ 中構建 ISO 8601 日期時間?)
Sort list using STL sort function(使用 STL 排序功能對列表進行排序)
主站蜘蛛池模板: 久久久久久久香蕉 | 欧美一级特黄aaa大片在线观看 | 国产精品久久福利 | 色黄视频在线 | 亚洲国产精品suv | 国产日韩一区二区三免费高清 | 成人在线看片 | 国产精品成人一区二区三区夜夜夜 | 欧美精品久久久 | 日韩不卡一区二区三区 | 日韩国产三区 | 日韩一区中文字幕 | 中文字幕一区二区三区四区不卡 | 91大神在线资源观看无广告 | 玖玖综合在线 | 久久国产秒 | 国产精品a免费一区久久电影 | 日韩中文字幕在线视频 | 蜜桃毛片 | 欧美黄色免费网站 | 欧美二区三区 | 国产欧美一区二区久久性色99 | 午夜精品久久久久久久久久久久久 | 中文字幕视频网 | 国产成人综合在线 | 91资源在线| 亚洲日产精品 | 操久久 | 人人99 | 性视频一区 | 国产精品一二三区 | 精品视频在线免费观看 | 久久国产一区 | 国产精品地址 | 国产成人精品久久二区二区91 | 91视频91 | 综合久久色 | av黄色国产 | 日韩国产中文字幕 | 欧美久久久久久久久中文字幕 | 亚洲一区在线播放 |