.\" Copyright (c) 2009 Michael Kerrisk, .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2012 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2012-05-31, Akihiro MOTOKI .\" .TH PTHREAD_SETCONCURRENCY 3 2014\-05\-23 Linux "Linux Programmer's Manual" .SH 名前 pthread_setconcurrency, pthread_getconcurrency \- 並列処理レベルの設定/取得を行う .SH 書式 .nf \fB#include \fP \fBint pthread_setconcurrency(int \fP\fInew_level\fP\fB);\fP \fBint pthread_getconcurrency(void);\fP .sp \fI\-pthread\fP でコンパイルしてリンクする。 .fi .SH 説明 \fBpthread_setconcurrency\fP() 関数は、アプリケーションが希望する 並列処理レベル (concurrency level) をスレッド実装に通知する。 希望する並列処理レベルは \fInew_level\fP で指定する。 スレッド実装はこの情報をヒントとしてのみ利用する。 POSIX.1 では、 \fBpthread_setconcurrency\fP() の呼び出した結果、 どのような並列度になるべきかは規定されていない。 \fInew_level\fP に 0 を指定すると、スレッド実装は並列処理レベルを 実装側で適切とみなしたレベルに設定するようになる。 \fBpthread_getconcurrency\fP() は、このプロセスの concurrency level の現在値を返す。 .SH 返り値 成功すると、 \fBpthread_setconcurrency\fP() は 0 を返す。 エラーの場合、 0 以外のエラー番号を返す。 \fBpthread_getconcurrency\fP() は常に成功し、最後の \fBpthread_getconcurrency\fP() の呼び出しで設定された concurrency level を返す。 \fBpthread_getconcurrency\fP() が それまでに一度も呼び出されていない場合は 0 が返る。 .SH エラー \fBpthread_setconcurrency\fP() は以下のエラーで失敗する場合がある。 .TP \fBEINVAL\fP \fInew_level\fP が負である。 .PP POSIX.1\-2001 には、エラー \fBEAGAIN\fP も記載されている (「\fInew_level\fP に指定された値を適用すると、システムリソースが 超過してしまう」)。 .SH バージョン これらの関数は glibc バージョン 2.1 以降で利用できる。 .SH 属性 .SS "マルチスレッディング (pthreads(7) 参照)" 関数 \fBpthread_setconcurrency\fP() と \fBpthread_getconcurrency\fP() はスレッドセーフである。 .SH 準拠 POSIX.1\-2001. .SH 注意 デフォルトの concurrency level は 0 である。 並列処理レベルが意味を持つのは M:N スレッド実装の場合のみである。 M:N スレッド実装では、ある瞬間において、あるプロセスのユーザーレベルスレッ ドの集合のサブ集合が、そのサブ集合のサイズよりも少ない数のカーネルの スケジューリング実体 (kernel\-scheduling entity) に結び付けられる。 並列処理レベルを設定すると、そのアプリケーションの効率的な実行に必要な カーネルのスケジューリング実体の数のヒントを、アプリケーションはシステ ムに伝えることができる。 LinuxThreads と NPTL のどちらも 1:1 スレッド実装であり、 並列処理レベルを設定しても何の意味もない。 言い換えると、 Linux では、これらの関数は、 他のシステムとの互換性のためだけに存在し、 プログラムの実行には何の影響も与えないということである。 .SH 関連項目 \fBpthread_attr_setscope\fP(3), \fBpthreads\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。