pthreadまたはその他のスレッドAPIを使用していますか?
1463 次
3 に答える
5
はい、Linux の gcc は pthread を使用します。
于 2012-06-01T16:04:27.817 に答える
1
それは、GCC をコンパイルするものに依存します。標準の Linux 実装には、OpenMP 用の posix スレッドが付属していますgcc -v
。ターミナルで入力します。
これは私のラップトップからの出力で、関心のある部分が太字になっています
[n@N-pc-t61 ~]$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-redhat-linux/4.6.3/lto-wrapper
Target: i686-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
**Thread model: posix**
gcc Web サイトから利用可能なすべてのオプションを次に示します。
--enable-threads=lib
Specify that lib is the thread support library. This affects the Objective-C compiler and runtime library, and exception handling for other languages like C++ and Java. The possibilities for lib are:
aix
AIX thread support.
dce
DCE thread support.
lynx
LynxOS thread support.
mipssde
MIPS SDE thread support.
no
This is an alias for `single'.
posix
Generic POSIX/Unix98 thread support.
rtems
RTEMS thread support.
single
Disable thread support, should work for all platforms.
tpf
TPF thread support.
vxworks
VxWorks thread support.
win32
Microsoft Win32 API thread support.
于 2012-06-01T16:16:07.703 に答える
0
OpenMP ランタイム ライブラリの 1 つは、OdinMP コンパイラの対象となる Balder ライブラリです。ライブラリとコンパイラは、ネストされた並列処理を含む OpenMP 2.0 を完全にサポートします。Balder ライブラリにはモジュール設計があり、いくつかのサブライブラリがあります。そのようなサブライブラリの 1 つは、Balder Threads と呼ばれる効率的な移植可能なスレッド ライブラリです。
于 2012-06-01T16:05:53.417 に答える