initial commit
[glibc.git] / debian / local / manpages / pthread_once.3
1 .TH PTHREAD_ONCE 3 LinuxThreads
2
3 .SH NAME
4 pthread_once \- once-only initialization
5
6 .SH SYNOPSIS
7 .B #include <pthread.h>
8
9 .BI "pthread_once_t " once_control " = PTHREAD_ONCE_INIT;"
10
11 .BI "int pthread_once(pthread_once_t *" once_control ", void (*" init_routine ") (void));"
12
13 .SH DESCRIPTION
14
15 The purpose of \fBpthread_once\fP is to ensure that a piece of
16 initialization code is executed at most once. The \fIonce_control\fP
17 argument points to a static or extern variable statically initialized
18 to \fBPTHREAD_ONCE_INIT\fP.
19
20 The first time \fBpthread_once\fP is called with a given \fIonce_control\fP
21 argument, it calls \fIinit_routine\fP with no argument and changes the
22 value of the \fIonce_control\fP variable to record that initialization has
23 been performed. Subsequent calls to \fBpthread_once\fP with the same
24 \fBonce_control\fP argument do nothing.
25
26 .SH "RETURN VALUE"
27 \fBpthread_once\fP always returns 0.
28
29 .SH ERRORS
30 None.
31
32 .SH AUTHOR
33 Xavier Leroy <Xavier.Leroy@inria.fr>
34