aboutsummaryrefslogtreecommitdiff
path: root/ja_JP.eucJP/man/man3/pthread_exit.3
blob: 62a2e2408980de92dd48a99cd44e0be40304078a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by John Birrell.
.\" 4. Neither the name of the author nor the names of any co-contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" %FreeBSD: src/lib/libc_r/man/pthread_exit.3,v 1.8.2.3 2001/03/06 16:46:08 ru Exp %
.\"
.\" $FreeBSD$
.Dd April 4, 1996
.Dt PTHREAD_EXIT 3
.Os BSD 4
.Sh 名称
.Nm pthread_exit
.Nd 呼び出しているスレッドの終了
.Sh ライブラリ
.Lb libc_r
.Sh 書式
.Fd #include <pthread.h>
.Ft void
.Fn pthread_exit "void *value_ptr"
.Sh 解説
.Fn pthread_exit
関数は、呼び出しているスレッドを終了し、
終了するスレッドと成功裏に待ち受けするために
.Fa value_ptr
の値を利用可能にします。
既にスタックに積まれていて取り出されていない取り消しクリーンアップハンドラは、
積まれたのと逆の順序で取り出され、実行されます。
全ての取り消しハンドラが実行された後で、スレッドがそのスレッド固有のデータを
持っている場合には、適切なデストラクタ関数が順序不定で呼び出されます。
スレッドの終了は、アプリケーションから見える全てのプロセスリソースを
開放しません。
このリソースは、mutex およびファイル記述子を含みますが、これに限りません。
また、あらゆるプロセスレベルのクリーンアップの実行も行ないません。
このクリーンアップは、存在する可能性のある
.Fn atexit
ルーチンの呼び出しを含みますが、これに限りません。
.Pp
.Fn main
を最初に実行したスレッド以外のスレッドが、その作成に使用された
開始ルーチンから戻った時に、暗黙的に
.Fn pthread_exit
が呼び出されます。
関数の戻り値は、スレッドの終了ステータスとして使用されます。
.Pp
暗黙的なまたは明示的な
.Fn pthread_exit
の呼び出しの結果として実行された取り消しハンドラまたはデストラクタ関数から
呼び出された場合の、
.Fn pthread_exit
の動作は未定義です。
.Pp
スレッドが終了した後での、そのスレッドのローカル (auto) 変数へのアクセスの
結果は未定義です。
従って、終了するスレッドのローカル変数への参照は、
.Fn pthread_exit
の
.Fa value_ptr
パラメータの値に使用されるべきではありません。
.Pp
最後のスレッドが終了した後で、プロセスは終了ステータス 0 で終了します。
スレッド終了時に実装が引数 0 で
.Fn exit
を呼び出したかのように動作します。
.Pp
.Sh 戻り値
.Fn pthread_exit
関数は呼び出し側には戻れません。
.Sh エラー
ありません。
.Pp
.Sh 関連項目
.Xr _exit 2 ,
.Xr exit 3 ,
.Xr pthread_create 3 ,
.Xr pthread_join 3
.Sh 規格
.Fn pthread_exit
は
.St -p1003.1-96
に適合しています。