107 lines
3.2 KiB
Groff
107 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.
|
|
.\"
|
|
.\" %FreeBSD: src/lib/libc_r/man/pthread_once.3,v 1.6.2.7 2001/12/17 10:08:26 ru Exp %
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.Dd April 4, 1996
|
|
.Dt PTHREAD_ONCE 3
|
|
.Os
|
|
.Sh 名称
|
|
.Nm pthread_once
|
|
.Nd 動的なパッケージの初期化
|
|
.Sh ライブラリ
|
|
.Lb libc_r
|
|
.Sh 書式
|
|
.In pthread.h
|
|
.Pp
|
|
pthread_once_t
|
|
.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
|
|
を引数無しで呼び出します。
|
|
その後での同じ
|
|
.Fa once_control
|
|
を持つ
|
|
.Fn pthread_once
|
|
の呼び出しは、
|
|
.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
|
|
が一度も呼び出されていないかのような結果になります。
|
|
.Pp
|
|
定数
|
|
.Fa PTHREAD_ONCE_INIT
|
|
は、
|
|
.Aq Pa pthread.h
|
|
で定義されています。
|
|
.Pp
|
|
.Fa once_control
|
|
に自動保存期間がある、または
|
|
.Fa PTHREAD_ONCE_INIT
|
|
で初期化されていない場合には、
|
|
.Fn pthread_once
|
|
の動作は未定義です。
|
|
.Sh 戻り値
|
|
問題がない場合は、
|
|
.Fn pthread_once
|
|
関数は 0 を返します。
|
|
問題がある場合は、そのエラーを示すためにエラー番号が返されます。
|
|
.Sh エラー
|
|
ありません。
|
|
.Sh 規格
|
|
.Fn pthread_once
|
|
は
|
|
.St -p1003.1-96
|
|
に適合しています。
|