Update build glue for pkg_install-20090228.
[netbsd-mini2440.git] / lib / libpthread / pthread_barrier_init.3
blobee4050992e5e79d7cc8a1766d804ca26792b93d6
1 .\" $NetBSD: pthread_barrier_init.3,v 1.8 2008/04/30 13:10:52 martin Exp $
2 .\"
3 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
14 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
15 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
17 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 .\" POSSIBILITY OF SUCH DAMAGE.
24 .\"
25 .Dd January 30, 2003
26 .Dt PTHREAD_BARRIER_INIT 3
27 .Os
28 .Sh NAME
29 .Nm pthread_barrier_init
30 .Nd create a barrier
31 .Sh LIBRARY
32 .Lb libpthread
33 .Sh SYNOPSIS
34 .In pthread.h
35 .Ft int
36 .Fn pthread_barrier_init "pthread_barrier_t * restrict barrier" "const pthread_barrierattr_t * restrict attr" "unsigned int count"
37 .Sh DESCRIPTION
38 The
39 .Fn pthread_barrier_init
40 function creates a new barrier, with attributes specified with
41 .Fa attr
42 and
43 .Fa count .
44 The
45 .Fa count
46 parameter indicates the number of threads which will participate in the barrier.
48 .Fa attr
49 is NULL the default attributes are used.
50 Barriers are most commonly used in the decomposition of parallel loops.
51 .Sh RETURN VALUES
52 If successful,
53 .Fn pthread_barrier_init
54 will return zero and put the new barrier id into
55 .Fa barrier ,
56 otherwise an error number will be returned to indicate the error.
57 .Sh ERRORS
58 .Fn pthread_barrier_init
59 shall fail if:
60 .Bl -tag -width Er
61 .It Bq Er EAGAIN
62 The system lacks the resources to initialize another barrier.
63 .It Bq Er EINVAL
64 The value specified by
65 .Fa count
66 is zero.
67 .It Bq Er ENOMEM
68 Insufficient memory exists to initialize the barrier.
69 .El
70 .Pp
71 .Fn pthread_barrier_init
72 may fail if:
73 .Bl -tag -width Er
74 .It Bq Er EBUSY
75 The barrier structure has been initialized already.
76 .It Bq Er EINVAL
77 The value specified by
78 .Fa attr
79 is invalid.
80 .El
81 .Sh SEE ALSO
82 .Xr pthread_barrier_destroy 3 ,
83 .Xr pthread_barrier_wait 3 ,
84 .Xr pthread_barrierattr_destroy 3 ,
85 .Xr pthread_barrierattr_init 3
86 .Sh STANDARDS
87 .Fn pthread_barrier_init
88 conforms to
89 .St -p1003.1-2001 .