OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / draft / man3 / pthread_setschedparam.3
index 73099e7..0d09a4b 100644 (file)
 .\"         all rights reserved.
 .\" Translated 2012-05-04, Akihiro MOTOKI <amotoki@gmail.com>
 .\"
-.TH PTHREAD_SETSCHEDPARAM 3 2008\-11\-17 Linux "Linux Programmer's Manual"
+.TH PTHREAD_SETSCHEDPARAM 3 2014\-12\-31 Linux "Linux Programmer's Manual"
 .SH 名前
 pthread_setschedparam, pthread_getschedparam \- スレッドの
-スケジューリングポリシーとパラメータを設定/取得する
\82¹ã\82±ã\82¸ã\83¥ã\83¼ã\83ªã\83³ã\82°ã\83\9dã\83ªã\82·ã\83¼ã\81¨ã\83\91ã\83©ã\83¡ã\83¼ã\82¿ã\83¼ã\82\92設å®\9a\8f\96å¾\97ã\81\99ã\82\8b
 .SH 書式
 .nf
 \fB#include <pthread.h>\fP
 
-\fBpthread_setschedparam(pthread_t \fP\fIthread\fP\fB, int \fP\fIpolicy\fP\fB,\fP
-\fB                      const struct sched_param *\fP\fIparam\fP\fB);\fP
-\fBpthread_getschedparam(pthread_t \fP\fIthread\fP\fB, int *\fP\fIpolicy\fP\fB,\fP
-\fB                      struct sched_param *\fP\fIparam\fP\fB);\fP
+\fBint pthread_setschedparam(pthread_t \fP\fIthread\fP\fB, int \fP\fIpolicy\fP\fB,\fP
+\fB                          const struct sched_param *\fP\fIparam\fP\fB);\fP
+\fBint pthread_getschedparam(pthread_t \fP\fIthread\fP\fB, int *\fP\fIpolicy\fP\fB,\fP
+\fB                          struct sched_param *\fP\fIparam\fP\fB);\fP
 .sp
 \fI\-pthread\fP でコンパイルしてリンクする。
 .fi
 .SH 説明
 \fBpthread_setschedparam\fP() 関数は、スレッド \fIthread\fP の
-スケジューリングポリシーとスケジューリングパラメータを設定する。
\82¹ã\82±ã\82¸ã\83¥ã\83¼ã\83ªã\83³ã\82°ã\83\9dã\83ªã\82·ã\83¼ã\81¨ã\82¹ã\82±ã\82¸ã\83¥ã\83¼ã\83ªã\83³ã\82°ã\83\91ã\83©ã\83¡ã\83¼ã\82¿ã\83¼ã\82\92設å®\9aã\81\99ã\82\8bã\80\82
 
 .\" FIXME . pthread_setschedparam() places no restriction on the policy,
 .\" but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=7013
-\fIpolicy\fP は \fIthread\fP の新しいスケジューリングポリシーを指定する。
-\fIpolicy\fP に指定できる値とその意味は \fBsched_setscheduler\fP(2) で
-説明されている。
+\fIpolicy\fP は \fIthread\fP の新しいスケジューリングポリシーを指定する。 \fIpolicy\fP に指定できる値とその意味は
+\fBsched\fP(7) で説明されている。
 
-\fIparam\fP が指す構造体は \fIthread\fP の新しいスケジューリングパラメータを
-指定する。スケジューリングパラメータは以下の構造体で管理される。
+\fIparam\fP ã\81\8cæ\8c\87ã\81\99æ§\8bé\80 ä½\93ã\81¯ \fIthread\fP ã\81®æ\96°ã\81\97ã\81\84ã\82¹ã\82±ã\82¸ã\83¥ã\83¼ã\83ªã\83³ã\82°ã\83\91ã\83©ã\83¡ã\83¼ã\82¿ã\83¼ã\82\92
\8c\87å®\9aã\81\99ã\82\8bã\80\82ã\82¹ã\82±ã\82¸ã\83¥ã\83¼ã\83ªã\83³ã\82°ã\83\91ã\83©ã\83¡ã\83¼ã\82¿ã\83¼ã\81¯ä»¥ä¸\8bã\81®æ§\8bé\80 ä½\93ã\81§ç®¡ç\90\86ã\81\95ã\82\8cã\82\8bã\80\82
 
 .in +4n
 .nf
@@ -70,9 +69,8 @@ struct sched_param {
 .fi
 .in
 
-見て分かる通り、サポートされているスケジューリングパラメータは一つだけ
-である。各スケジューリングポリシーで許可されるスケジューリング優先度の
-詳細については、\fBsched_setscheduler\fP(2) を参照のこと。
+見て分かる通り、サポートされているスケジューリングパラメーターは一つだけである。各スケジューリングポリシーで許可されるスケジューリング優先度の詳細については、\fBsched\fP(7)
+を参照のこと。
 
 .\" FIXME . nptl/pthread_setschedparam.c has the following
 .\"   /* If the thread should have higher priority because of some
@@ -80,8 +78,8 @@ struct sched_param {
 .\" Eventually (perhaps after writing the mutexattr pages), we
 .\" may want to add something on the topic to this page.
 \fBpthread_getschedparam\fP() 関数は、スレッド \fIthread\fP の
-スケジューリングポリシーとパラメータを、
-それぞれ \fIpolicy\fP と \fIparam\fP が指すバッファに入れて返す。
\82¹ã\82±ã\82¸ã\83¥ã\83¼ã\83ªã\83³ã\82°ã\83\9dã\83ªã\82·ã\83¼ã\81¨ã\83\91ã\83©ã\83¡ã\83¼ã\82¿ã\83¼ã\82\92ã\80\81
\81\9dã\82\8cã\81\9eã\82\8c \fIpolicy\fP ã\81¨ \fIparam\fP ã\81\8cæ\8c\87ã\81\99ã\83\90ã\83\83ã\83\95ã\82¡ã\83¼ã\81«å\85¥ã\82\8cã\81¦è¿\94ã\81\99ã\80\82
 返された優先度の値は、最も最近実行した \fIthread\fP に影響を与える
 \fBpthread_setschedparam\fP(), \fBpthread_setschedprio\fP,
 \fBpthread_create\fP で設定された値となる。
@@ -93,7 +91,7 @@ struct sched_param {
 成功すると、これらの関数は 0 を返す。
 エラーの場合、0 以外のエラー番号を返す。
 \fBpthread_setschedparam\fP() が失敗した場合、 \fIthread\fP の
-スケジューリングポリシーとパラメータは変更されない。
\82¹ã\82±ã\82¸ã\83¥ã\83¼ã\83ªã\83³ã\82°ã\83\9dã\83ªã\82·ã\83¼ã\81¨ã\83\91ã\83©ã\83¡ã\83¼ã\82¿ã\83¼ã\81¯å¤\89æ\9b´ã\81\95ã\82\8cã\81ªã\81\84ã\80\82
 .SH エラー
 これらの関数はどちらも以下のエラーで失敗する場合がある。
 .TP 
@@ -107,20 +105,22 @@ ID が \fIthread\fP のスレッドが見つからなかった。
 \fIparam\fP が \fIpolicy\fP では意味を持たない値である。
 .TP 
 \fBEPERM\fP
-呼び出し側が、指定されたスケジューリングポリシーやパラメータを設定する
\91¼ã\81³å\87ºã\81\97å\81´ã\81\8cã\80\81æ\8c\87å®\9aã\81\95ã\82\8cã\81\9fã\82¹ã\82±ã\82¸ã\83¥ã\83¼ã\83ªã\83³ã\82°ã\83\9dã\83ªã\82·ã\83¼ã\82\84ã\83\91ã\83©ã\83¡ã\83¼ã\82¿ã\83¼ã\82\92設å®\9aã\81\99ã\82\8b
 のに必要な特権を持たない。
 .PP
 .\" .SH VERSIONS
 .\" Available since glibc 2.0
 POSIX.1\-2001 では、 \fBpthread_setschedparam\fP() に関して
 エラー \fBENOTSUP\fP ("サポートされていない値をスケジューリングポリシーや
-パラメータに設定しようとした") も追加で規定されている。
+パラメーターに設定しようとした") も追加で規定されている。
+.SH 属性
+.SS "マルチスレッディング (pthreads(7) 参照)"
+関数 \fBpthread_setschedparam\fP() と \fBpthread_getschedparam\fP() はスレッドセーフである。
 .SH 準拠
 POSIX.1\-2001.
 .SH 注意
-スレッドのスケジューリングポリシーや優先度を変更するために必要な許可や
-変更した場合の影響、および各スケジューリングポリシーで認められる優先度
-の範囲の詳細については、 \fBsched_setscheduler\fP(2) を参照。
+スレッドのスケジューリングポリシーや優先度を変更するために必要な許可や変更した場合の影響、および各スケジューリングポリシーで認められる優先度の範囲の詳細については、
+\fBsched\fP(7) を参照。
 .SH 例
 以下のプログラムは \fBpthread_setschedparam\fP() と
 \fBpthread_getschedparam\fP() やスケジューリングに関連する pthreads の
@@ -217,7 +217,7 @@ usage(char *prog_name, char *msg)
     fpe("                     r  SCHED_RR\en");
     fpe("                     o  SCHED_OTHER\en");
     fpe("\-A               Use default thread attributes object\en");
-    fpe("\-i {e|s}         Set inherit scheduler attribute to\en");
+    fpe("\-i {e|i}         Set inherit scheduler attribute to\en");
     fpe("                 \(aqexplicit\(aq or \(aqinherit\(aq\en");
     fpe("\-m<policy><prio> Set scheduling policy and priority on\en");
     fpe("                 main thread before pthread_create() call\en");
@@ -304,7 +304,7 @@ main(int argc, char *argv[])
 
     if (main_sched_str != NULL) {
         if (!get_policy(main_sched_str[0], &policy))
-            usage(argv[0], "Bad policy for main thread (\-s)\en");
+            usage(argv[0], "Bad policy for main thread (\-m)\en");
         param.sched_priority = strtol(&main_sched_str[1], NULL, 0);
 
         s = pthread_setschedparam(pthread_self(), policy, &param);
@@ -383,9 +383,11 @@ main(int argc, char *argv[])
 
     /* Destroy unneeded thread attributes object */
 
-    s = pthread_attr_destroy(&attr);
-    if (s != 0)
-        handle_error_en(s, "pthread_attr_destroy");
+    if (!use_null_attrib) {
+      s = pthread_attr_destroy(&attr);
+      if (s != 0)
+          handle_error_en(s, "pthread_attr_destroy");
+    }
 
     s = pthread_join(thread, NULL);
     if (s != 0)
@@ -397,12 +399,11 @@ main(int argc, char *argv[])
 .SH 関連項目
 .ad l
 .nh
-\fBgetrlimit\fP(2), \fBsched_get_priority_min\fP(2), \fBsched_setscheduler\fP(2),
-\fBpthread_attr_init\fP(3), \fBpthread_attr_setinheritsched\fP(3),
-\fBpthread_attr_setschedparam\fP(3), \fBpthread_attr_setschedpolicy\fP(3),
-\fBpthread_create\fP(3), \fBpthread_self\fP(3), \fBpthread_setschedprio\fP(3),
-\fBpthreads\fP(7)
+\fBgetrlimit\fP(2), \fBsched_get_priority_min\fP(2), \fBpthread_attr_init\fP(3),
+\fBpthread_attr_setinheritsched\fP(3), \fBpthread_attr_setschedparam\fP(3),
+\fBpthread_attr_setschedpolicy\fP(3), \fBpthread_create\fP(3), \fBpthread_self\fP(3),
+\fBpthread_setschedprio\fP(3), \fBpthreads\fP(7), \fBsched\fP(7)
 .SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
 である。プロジェクトの説明とバグ報告に関する情報は
 http://www.kernel.org/doc/man\-pages/ に書かれている。