OSDN Git Service

77a812e92d40b9a3fac01431bfd9e4be519c4d39
[linuxjm/LDP_man-pages.git] / draft / man3 / sem_destroy.3
1 '\" t
2 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\"
4 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
27 .\" Translated 2006-04-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
28 .\"
29 .TH SEM_DESTROY 3 2006-03-25 "Linux" "Linux Programmer's Manual"
30 .\"O .SH NAME
31 .SH 名前
32 .\"O sem_destroy \- destroy an unnamed semaphore
33 sem_destroy \- 名前なしセマフォを破棄する
34 .\"O .SH SYNOPSIS
35 .SH 書式
36 .nf
37 .B #include <semaphore.h>
38 .sp
39 .BI "int sem_destroy(sem_t *" sem );
40 .fi
41 .sp
42 .\"O Link with \fI\-lrt\fP or \fI\-pthread\fP.
43 \fI\-lrt\fP または \fI\-pthread\fP でリンクする。
44 .\"O .SH DESCRIPTION
45 .SH 説明
46 .\"O .BR sem_destroy ()
47 .\"O destroys the unnamed semaphore at the address pointed to by
48 .\"O .IR sem .
49 .BR sem_destroy ()
50
51 .I sem
52 が指すアドレスにある名前なしセマフォを破棄する。
53
54 .\"O Only a semaphore that has been initialized by
55 .\"O .BR sem_init (3)
56 .\"O should be destroyed using
57 .\"O .BR sem_destroy ().
58 .BR sem_destroy ()
59 を使って破棄するのは、
60 .BR sem_init (3)
61 で初期化したセマフォだけにすべきである。
62
63 .\"O Destroying a semaphore that other processes or threads are
64 .\"O currently blocked on (in
65 .\"O .BR sem_wait (3))
66 .\"O produces undefined behavior.
67 他のプロセスやスレッドが
68 .RB ( sem_wait (3)
69 で) 待ち状態になっているセマフォを破棄した場合の挙動は定義されていない。
70
71 .\"O Using a semaphore that has been destroyed produces undefined results,
72 .\"O until the semaphore has been reinitialized using
73 .\"O .BR sem_init (3).
74 すでに破棄されたセマフォを、
75 .BR sem_init (3)
76 を使って再初期化される前に使用した場合、その結果は未定義である。
77 .\"O .SH RETURN VALUE
78 .SH 返り値
79 .\"O .BR sem_destroy ()
80 .\"O returns 0 on success;
81 .\"O on error, \-1 is returned, and
82 .\"O .I errno
83 .\"O is set to indicate the error.
84 成功すると、
85 .BR sem_destroy ()
86 は 0 を返す。エラーの場合、\-1 を返し、
87 .I errno
88 にエラーを示す値をセットする。
89 .\"O .SH ERRORS
90 .SH エラー
91 .TP
92 .B EINVAL
93 .\"O .I sem
94 .\"O is not a valid semaphore.
95 .I sem
96 は有効なセマフォではない。
97 .\"O .SH CONFORMING TO
98 .SH 準拠
99 POSIX.1-2001.
100 .\"O .SH NOTES
101 .SH 注意
102 .\"O An unnamed semaphore should be destroyed with
103 .\"O .BR sem_destroy ()
104 .\"O before the memory in which it is located is deallocated.
105 .\"O Failure to do this can result in resource leaks on some implementations.
106 .\"O .\" But not on NPTL, where sem_destroy () is a no-op..
107 名前なしセマフォは、そのセマフォが置かれているメモリが解放される前に、
108 .BR sem_destroy ()
109 を使って破棄しておくべきである。これを行わなかった場合、実装によっては
110 リソースのリークが起こりえる。
111 .\" NPTL ではリークは起こらない。sem_destroy () は何もしないだけ..
112 .\"O .SH "SEE ALSO"
113 .SH 関連項目
114 .BR sem_init (3),
115 .BR sem_post (3),
116 .BR sem_wait (3),
117 .BR sem_overview (7)