OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / release / man3 / pthread_tryjoin_np.3
1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\"*******************************************************************
27 .\"
28 .\" This file was generated with po4a. Translate the source file.
29 .\"
30 .\"*******************************************************************
31 .\"
32 .\" Japanese Version Copyright (c) 2012  Akihiro MOTOKI
33 .\"         all rights reserved.
34 .\" Translated 2012-05-04, Akihiro MOTOKI <amotoki@gmail.com>
35 .\"
36 .TH PTHREAD_TRYJOIN_NP 3 2015\-01\-10 Linux "Linux Programmer's Manual"
37 .SH 名前
38 pthread_tryjoin_np, pthread_timedjoin_np \- 終了したスレッドの join を
39 試みる
40 .SH 書式
41 .nf
42 \fB#define _GNU_SOURCE\fP             /* See feature_test_macros(7) */
43 \fB#include <pthread.h>\fP
44
45 \fBint pthread_tryjoin_np(pthread_t \fP\fIthread\fP\fB, void **\fP\fIretval\fP\fB);\fP
46
47 \fBint pthread_timedjoin_np(pthread_t \fP\fIthread\fP\fB, void **\fP\fIretval\fP\fB,\fP
48 \fB                         const struct timespec *\fP\fIabstime\fP\fB);\fP
49 .fi
50 .sp
51 \fI\-pthread\fP を付けてコンパイルとリンクを行う。
52 .SH 説明
53 これらの関数は \fBpthread_join\fP(3) と同じように動作するが、
54 このページで説明する違いがある。
55
56 \fBpthread_tryjoin_np\fP() 関数は、スレッド \fIthread\fP の非停止
57 (nonblocking) での join を実行し、スレッドの終了ステータスを
58 \fI*retval\fP に入れて返す。\fIthread\fP がまだ終了していない場合は、
59 \fBpthread_join\fP(3) のように停止 (block) せずに、エラーを返す。
60
61 \fBpthread_timedjoin_np\fP() 関数は、タイムアウト付きの join を行う。
62 \fIthread\fP がまだ終了していない場合、 \fIabstime\fP で指定された最大時間
63 まで停止する。 \fIthread\fP が終了する前にタイムアウト時間が経過した場合は、
64 エラーを返す。\fIabstime\fP 引き数は以下に示す構造体であり、
65 Epoch (時刻紀元; \fBtime\fP(2) 参照) から測った絶対時刻を指定する。
66
67 .in +4n
68 .nf
69 struct timespec {
70     time_t tv_sec;     /* seconds */
71     long   tv_nsec;    /* nanoseconds */
72 };
73 .fi
74 .in
75 .SH 返り値
76 成功すると、これらの関数は 0 を返す。
77 エラーの場合、エラー番号を返す。
78 .SH エラー
79 これらの関数は \fBpthread_join\fP(3) と同じエラーで失敗する。
80 \fBpthread_tryjoin_np\fP() はさらに以下のエラーで失敗する場合がある。
81 .TP 
82 \fBEBUSY\fP
83 呼び出しを行った時点では \fIthread\fP はまだ終了していない。
84 .PP
85 \fBpthread_timedjoin_np\fP() はさらに以下のエラーで失敗する場合がある。
86 .TP 
87 \fBETIMEDOUT\fP
88 \fIthread\fP が終了する前に呼び出しがタイムアウトとなった。
89 .TP 
90 \fBEINVAL\fP
91 \fIabstime\fP の値が無効である (\fItv_sec\fP が 0 より小さいか、 \fItv_nsec\fP 1e9 がより大きい)。
92 .PP
93 \fBpthread_timedjoin_np\fP() がエラー \fBEINTR\fP を返すことはない。
94 .SH バージョン
95 これらの関数は glibc バージョン 2.3.3 で初めて登場した。
96 .SH 準拠
97 これらの関数は非標準の GNU による拡張である。
98 そのため、名前に "_np" (nonportable; 移植性がない) という接尾辞が
99 付いている。
100 .SH 例
101 以下のコードは、最大 5 秒まで join を待つ。
102
103 .nf
104     struct timespec ts;
105     int s;
106
107     ...
108
109     if (clock_gettime(CLOCK_REALTIME, &ts) == \-1) {
110         /* Handle error */
111     }
112
113     ts.tv_sec += 5;
114
115     s = pthread_timedjoin_np(thread, NULL, &ts);
116     if (s != 0) {
117         /* Handle error */
118     }
119 .fi
120 .SH 関連項目
121 \fBclock_gettime\fP(2), \fBpthread_exit\fP(3), \fBpthread_join\fP(3), \fBpthreads\fP(7)
122 .SH この文書について
123 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
124 である。プロジェクトの説明とバグ報告に関する情報は
125 http://www.kernel.org/doc/man\-pages/ に書かれている。