在windows的gcc端口thread_posixs和thread_win32之间的区别? [英] Whats the difference between thread_posixs and thread_win32 in gcc port of windows?

查看:2572
本文介绍了在windows的gcc端口thread_posixs和thread_win32之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想下载适用于Windows的 gcc 4.7.2 编译器的最新版本。

当我得到这个 page 其中我应该看到一个下载链接,我面对两个类别:

I wanted to download the latest available version of gcc 4.7.2 compiler for windows.
When i got to this page where i was supposed to see a download link , i confronted with two categories:


  1. threads-posix

  2. threads-win32



    这两者之间的区别是什么?

    它们是否仅仅是线程实现?我的意思是它们只是如何实现不同,因此结果结果类,如何使用它们等)保持不变?

    或者他们强加一种特定的编码风格吗?

Whats the difference between these two?
Are they thread implementations only?I mean are they only different in how they are implemented and thus the ending result (classes, how to use them,etc ) remains the same?
Or do they impose a specific coding style?

推荐答案

所以,你提供的链接导致构建独立的gcc 4.7.2 for windows,a.k.a mingw64。为了构建这个编译器,使用一组脚本,这有助于定义编译的选项。脚本简称为MinGW-builds,可以在不同的地方找到:

So, the link you provided leads to builds of the standalone gcc 4.7.2 for windows, a.k.a mingw64. In order to build this compiler, a set of scripts are used, which help define the options of compilations. The scripts are simply called MinGW-builds, and can be found in different places:

  • google code
  • github fork

脚本有一个选项,指定哪个线程模型用于std :: threads部分C ++ 11标准(这适用于MinGW,因为在该版本上应用了实验性补丁的GCC)。
在一种情况下,使用win32线程API,在另一种情况下使用posix API。

The scripts have an option which specify which thread model is to be used for the std::threads part of the C++11 standard (this is allowed for MinGW thanks to an experimental patch applied on that version of GCC). In one case, the win32 thread API is used, and in the other case it's the posix API which is used.

不支持所有的POSIX API开箱即用,因此需要使用一些外部仿真库(winpthreads)。

Note that Windows doesn't support all the POSIX API out of the box, so some external emulation library needs to be used (winpthreads).

GCC源配置脚本一个选项来指定API(--enable-threads =),这是在构建脚本中使用的。

The GCC source configure script has an option to specify that API (--enable-threads=), and that's what is used in the build scripts.

总之,对于这个版本的mingw, threads-posix release将使用posix API和允许使用std :: thread ,并且threads-win32将使用win32 API,并且禁用std :: thread的一部分标准

In short, for this version of mingw, the threads-posix release will use the posix API and allow the use of std::thread, and the threads-win32 will use the win32 API, and disable the std::thread part of the standard.

这篇关于在windows的gcc端口thread_posixs和thread_win32之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆