OSDN Git Service

3e0faf31a76183339f84a411cc35dd567ba5d824
[linuxjm/jm.git] / manual / LDP_man-pages / draft / 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 2020\-12\-21 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 .PP
45 \fBint pthread_tryjoin_np(pthread_t \fP\fIthread\fP\fB, void **\fP\fIretval\fP\fB);\fP
46 .PP
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 .PP
51 \fI\-pthread\fP を付けてコンパイルとリンクを行う。
52 .SH 説明
53 これらの関数は \fBpthread_join\fP(3) と同じように動作するが、
54 このページで説明する違いがある。
55 .PP
56 \fBpthread_tryjoin_np\fP() 関数は、スレッド \fIthread\fP の非停止
57 (nonblocking) での join を実行し、スレッドの終了ステータスを
58 \fI*retval\fP に入れて返す。\fIthread\fP がまだ終了していない場合は、
59 \fBpthread_join\fP(3) のように停止 (block) せずに、エラーを返す。
60 .PP
61 The \fBpthread_timedjoin_np\fP()  function performs a join\-with\-timeout.  If
62 \fIthread\fP has not yet terminated, then the call blocks until a maximum time,
63 specified in \fIabstime\fP, measured against the \fBCLOCK_REALTIME\fP clock.  If
64 the timeout expires before \fIthread\fP terminates, the call returns an error.
65 The \fIabstime\fP argument is a structure of the following form, specifying an
66 absolute time measured since the Epoch (see \fBtime\fP(2)):
67 .PP
68 .in +4n
69 .EX
70 struct timespec {
71     time_t tv_sec;     /* seconds */
72     long   tv_nsec;    /* nanoseconds */
73 };
74 .EE
75 .in
76 .SH 返り値
77 成功すると、これらの関数は 0 を返す。
78 エラーの場合、エラー番号を返す。
79 .SH エラー
80 これらの関数は \fBpthread_join\fP(3) と同じエラーで失敗する。
81 \fBpthread_tryjoin_np\fP() はさらに以下のエラーで失敗する場合がある。
82 .TP 
83 \fBEBUSY\fP
84 呼び出しを行った時点では \fIthread\fP はまだ終了していない。
85 .PP
86 \fBpthread_timedjoin_np\fP() はさらに以下のエラーで失敗する場合がある。
87 .TP 
88 \fBETIMEDOUT\fP
89 \fIthread\fP が終了する前に呼び出しがタイムアウトとなった。
90 .TP 
91 \fBEINVAL\fP
92 \fIabstime\fP の値が無効である (\fItv_sec\fP が 0 より小さいか、 \fItv_nsec\fP 1e9 がより大きい)。
93 .PP
94 \fBpthread_timedjoin_np\fP() がエラー \fBEINTR\fP を返すことはない。
95 .SH バージョン
96 これらの関数は glibc バージョン 2.3.3 で初めて登場した。
97 .SH 属性
98 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。
99 .ad l
100 .TS
101 allbox;
102 lbw22 lb lb
103 l l l.
104 インターフェース        属性  値
105 T{
106 \fBpthread_tryjoin_np\fP(),
107 \fBpthread_timedjoin_np\fP()
108 T}      Thread safety   MT\-Safe
109 .TE
110 .ad
111 .SH 準拠
112 これらの関数は非標準の GNU による拡張である。
113 そのため、名前に "_np" (nonportable; 移植性がない) という接尾辞が
114 付いている。
115 .SH EXAMPLES
116 以下のコードは、最大 5 秒まで join を待つ。
117 .PP
118 .in +4n
119 .EX
120 struct timespec ts;
121 int s;
122
123 \&...
124
125 if (clock_gettime(CLOCK_REALTIME, &ts) == \-1) {
126     /* Handle error */
127 }
128
129 ts.tv_sec += 5;
130
131 s = pthread_timedjoin_np(thread, NULL, &ts);
132 if (s != 0) {
133     /* Handle error */
134 }
135 .EE
136 .in
137 .SH バグ
138 The \fBpthread_timedjoin_np\fP()  function measures time by internally
139 calculating a relative sleep interval that is then measured against the
140 \fBCLOCK_MONOTONIC\fP clock instead of the \fBCLOCK_REALTIME\fP clock.
141 Consequently, the timeout is unaffected by discontinuous changes to the
142 \fBCLOCK_REALTIME\fP clock.
143 .SH 関連項目
144 \fBclock_gettime\fP(2), \fBpthread_exit\fP(3), \fBpthread_join\fP(3), \fBpthreads\fP(7)
145 .SH この文書について
146 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は
147 \%https://www.kernel.org/doc/man\-pages/ に書かれている。