This section is based on catpages contributed by Mainichi Communications, Inc. Translated by: MYCOM team Converted by: Japanese Online Manual Project <man-jp@jp.FreeBSD.ORG> Submitted by: Kazuo Horikawa <k-horik@yk.rim.or.jp>
103 lines
3.2 KiB
Groff
103 lines
3.2 KiB
Groff
.\" 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.
|
|
.\"
|
|
.Dd April 4, 1996
|
|
.Dt PTHREAD_ONCE 3
|
|
.Os BSD 4
|
|
.Sh 名称
|
|
.Nm pthread_once
|
|
.Nd ダイナミックなパッケージの初期化
|
|
.Sh 書式
|
|
.Fd #include <pthread.h>
|
|
.Pp
|
|
pthread_once
|
|
.Fa once_control
|
|
= PTHREAD_ONCE_INIT;
|
|
.Ft int
|
|
.Fn pthread_once "pthread_once_t *once_control" "void (*init_routine)(void)"
|
|
.Sh 解説
|
|
プロセスの任意のスレッドで特定の
|
|
.Fa once_control
|
|
を使用して
|
|
.Fn pthread_once
|
|
を初めて呼び出すと、引数なしで
|
|
.Fn init_routine
|
|
が呼び出されます。その後で
|
|
.Fn pthread_once
|
|
を同じ
|
|
.Fa once_control
|
|
で呼び出しても、
|
|
.Fn init_routine
|
|
は呼び出されません。
|
|
.Fn pthread_once
|
|
から戻る時点では、
|
|
.Fn init_routine
|
|
は終了しています。
|
|
.Fa once_control
|
|
パラメータは、関連する初期化ルーチンが呼び出されているかどうかを
|
|
判断するために使用されます。
|
|
.Pp
|
|
.Fn pthread_once
|
|
関数はキャンセルポイントではありませんが、
|
|
.Fn init_routine
|
|
はキャンセルポイントであるためキャンセルされます。キャンセルされると、
|
|
.Fa once_control
|
|
には
|
|
.Fn pthread_once
|
|
.Fa が呼び出されていないかのような
|
|
効果が生まれます。
|
|
.Pp
|
|
ヘッダ
|
|
.Aq Pa pthread.h
|
|
で、定数
|
|
.Fa PTHREAD_ONCE_INIT
|
|
が定義されています。
|
|
.Pp
|
|
.Fa once_control
|
|
に自動保存期間がある場合、または
|
|
.Fa once_control
|
|
が
|
|
.Fa PTHREAD_ONCE_INIT
|
|
で初期化されない場合、
|
|
.Fn pthread_once
|
|
の動作は不定になります。
|
|
.Sh 戻り値
|
|
問題がない場合、
|
|
.Fn pthread_once
|
|
関数はゼロを戻します。問題がある場合は、そのエラーを示すエラー番号を戻します。
|
|
.Sh エラー
|
|
ありません。
|
|
.Sh 規格
|
|
.Fn pthread_once
|
|
は、
|
|
ISO/IEC 9945-1 ANSI/IEEE
|
|
.Pq Dq Tn POSIX
|
|
Std 1003.1 Second Edition 1996-07-12
|
|
に準拠しています。
|