Man pages for libpthread, written by Stephen Degler.

This commit is contained in:
nathanw 2003-06-03 21:31:36 +00:00
parent 899161bdbc
commit 380bb3a8b0
8 changed files with 681 additions and 0 deletions

View File

@ -0,0 +1,73 @@
.\" $Header: /cvsroot/src/lib/libpthread/Attic/pthread_barrier_destroy.3,v 1.1 2003/06/03 21:31:36 nathanw Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" 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. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 January 30, 2003
.Dt PTHREAD_BARRIER_DESTROY 3
.Os
.Sh NAME
.Nm pthread_barrier_destory
.Nd destroy a barrier
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_barrier_destroy "pthread_barrier_t *barrier"
.Sh DESCRIPTION
The
.Fn pthread_barrier_destroy
function causes the resources allocated to
.Fa barrier
to be released. No threads should be blocked on
.Fa barrier .
.Sh RETURN VALUES
If successful,
.Fn pthread_barrier_destroy
will return zero.
Otherwise an error value will be returned.
.Sh ERRORS
.Fn pthread_barrier_destroy
may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa barrier
is invalid.
.It Bq Er EBUSY
The
.Fa barrier
still has active threads associated with it.
.El
.Sh SEE ALSO
.Xr pthread_barrier_init 3 ,
.Xr pthread_barrier_wait 3 ,
.Xr pthread_barrierattr_init 3 ,
.Xr pthread_barrierattr_destroy 3
.Sh STANDARDS
.Fn pthread_barrier_destroy
conforms to
.St -p1003.1-2001 .

View File

@ -0,0 +1,93 @@
.\" $Header: /cvsroot/src/lib/libpthread/Attic/pthread_barrier_init.3,v 1.1 2003/06/03 21:31:36 nathanw Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" 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. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 January 30, 2003
.Dt PTHREAD_BARRIER_INIT 3
.Os
.Sh NAME
.Nm pthread_barrier_init
.Nd create a barrier
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_barrier_init "pthread_barrier_t *barrier" "const pthread_barrierattr_t *attr" "unsigned int count"
.Sh DESCRIPTION
The
.Fn pthread_barrier_init
function creates a new barrier, with attributes specified with
.Fa attr
and
.Fa count .
The
.Fa count
parameter indicates the number of threads which will participate in the barrier.
If
.Fa attr
is NULL the default attributes are used.
Barriers are most commonly used in the decomposition of parallel loops.
.Sh RETURN VALUES
If successful,
.Fn pthread_barrier_init
will return zero and put the new barrier id into
.Fa barrier ,
otherwise an error number will be returned to indicate the error.
.Sh ERRORS
.Fn pthread_barrier_init
shall fail if:
.Bl -tag -width Er
.It Bq Er EAGAIN
The system lacks the resources to initialize another barrier.
.It Bq Er EINVAL
The value specified by
.Fa count
is zero.
.It Bq Er ENOMEM
Insufficent memory exists to initialize the barrier.
.El
.Pp
.Fn pthread_barrier_init
may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.It Bq Er EBUSY
The barrier structure has been initialized already.
.El
.Sh SEE ALSO
.Xr pthread_barrier_destroy 3 ,
.Xr pthread_barrier_wait 3 ,
.Xr pthread_barrierattr_init 3 ,
.Xr pthread_barrierattr_destroy 3
.Sh STANDARDS
.Fn pthread_barrier_init
conforms to
.St -p1003.1-2001 .

View File

@ -0,0 +1,79 @@
.\" $Header: /cvsroot/src/lib/libpthread/Attic/pthread_barrier_wait.3,v 1.1 2003/06/03 21:31:36 nathanw Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" 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. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 January 30, 2003
.Dt PTHREAD_BARRIER_WAIT 3
.Os
.Sh NAME
.Nm pthread_barrier_wait
.Nd wait for a barrier
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_barrier_wait "pthread_barrier_t *barrier"
.Sh DESCRIPTION
The
.Fn pthread_barrier_wait
function causes the current thread to wait on the barrier specified.
Once as many threads as specified by the
.Fa count
parameter to the corresponding
.Fn pthread_barrier_init
call have called
.Fn pthread_barrier_wait ,
all threads will wake up, return from their respective
.Fn pthread_barrier_wait
calls and continue execution.
.Sh RETURN VALUES
If successful,
.Fn pthread_barrier_wait
will return zero for all waiting threads except for one. One thread will
receive status
.Dv PTHREAD_BARRIER_SERIAL_THREAD ,
which is intended to indicate that this thead may be used to update
shared data. It is the responsibilty of this thread to insure the visibility and atomicity of any updates to shared data with respect to the other threads participating in the barrier.
In the case of failure, an error value will be returned.
.Sh ERRORS
.Fn pthread_barrier_wait
may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa barrier
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_barrier_destroy 3 ,
.Xr pthread_barrier_init 3 ,
.Xr pthread_barrierattr_init 3 ,
.Xr pthread_barrierattr_destroy 3 ,
.Sh STANDARDS
.Fn pthread_barrier_wait
conforms to
.St -p1003.1-2001 .

View File

@ -0,0 +1,96 @@
.\" $Header: /cvsroot/src/lib/libpthread/pthread_barrierattr.3,v 1.1 2003/06/03 21:31:36 nathanw Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" 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. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 January 30, 2003
.Dt PTHREAD_BARRIERATTR 3
.Os
.Sh NAME
.Nm pthread_barrierattr_init ,
.Nm pthread_barrierattr_destroy ,
.Nd barrier attribute operations
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_barrierattr_init "pthread_barrierattr_t *attr"
.Ft int
.Fn pthread_barrierattr_destroy "pthread_barrierattr_t *attr"
.Sh DESCRIPTION
Barrier attributes are used to specify parameters to
.Fn pthread_barrier_init .
One attribute object can be used in multiple calls to
.Fn pthread_barrier_init ,
with or without modifications between calls.
.Pp
The
.Fn pthread_barrierattr_init
function initializes
.Fa attr
with all the default barrier attributes.
.Pp
The
.Fn pthread_barrierattr_destroy
function destroys
.Fa attr .
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicacte the error.
.Sh ERRORS
.Fn pthread_barrierattr_init
shall fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Insufficent memory exists to initialize the barrier attributes object.
.El
.Pp
.Fn pthread_barrierattr_init
may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid.
.El
.Pp
.Fn pthread_barrierattr_destroy
may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa attr
is invalid
.El
.Sh SEE ALSO
.Xr pthread_barrier_init 3
.Sh STANDARDS
.Fn pthread_barrierattr_init
and
.Fn pthread_barrierattr_destroy
conform to
.St -p1003.1-2001 .

View File

@ -0,0 +1,72 @@
.\" $Header: /cvsroot/src/lib/libpthread/Attic/pthread_spin_destroy.3,v 1.1 2003/06/03 21:31:36 nathanw Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" 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. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 January 30, 2003
.Dt PTHREAD_SPIN_DESTROY 3
.Os
.Sh NAME
.Nm pthread_spin_destroy
.Nd destroy a spin lock
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_spin_destroy "pthread_spinlock_t *lock"
.Sh DESCRIPTION
The
.Fn pthread_spin_destroy
function is used to destroy a spin lock previously created with
.Fn pthread_spin_init .
.Sh RETURN VALUES
If successful, the
.Fn pthread_spin_destroy
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh ERRORS
The
.Fn pthread_spin_destroy
function may fail if:
.Bl -tag -width Er
.It Bq Er EBUSY
The system has detected an attempt to destroy the object referenced by
.Fa lock
while it is locked.
.It Bq Er EINVAL
The value specified by
.Fa lock
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_spin_init 3 ,
.Xr pthread_spin_lock 3 ,
.Xr pthread_spin_trylock 3 ,
.Xr pthread_spin_unlock 3
.Sh STANDARDS
.Fn pthread_spin_destroy
conforms to
.St -p1003.1-2001 .

View File

@ -0,0 +1,88 @@
.\" $Header: /cvsroot/src/lib/libpthread/Attic/pthread_spin_init.3,v 1.1 2003/06/03 21:31:36 nathanw Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" 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. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 January 30, 2003
.Dt PTHREAD_SPIN_INIT 3
.Os
.Sh NAME
.Nm pthread_spin_init
.Nd initialize a spin lock
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_spin_init "pthread_spinlock_t *lock" "int pshared"
.Sh DESCRIPTION
The
.Fn pthread_spin_init
function is used to initialize a spinlock. The
.Fa pshared
parameter is currently unused and all spinlocks exhibit the
.Dv PTHREAD_PROCESS_SHARED
property.
.Pp
The results of calling
.Fn pthread_spin_init
with an already initialized lock are undefined.
.Sh RETURN VALUES
If successful, the
.Fn pthread_spin_init
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh ERRORS
The
.Fn pthread_spin_init
function shall fail if:
.Bl -tag -width Er
.It Bq Er ENOMEM
Insuffucent memory exists to initialize the lock.
.El
.Pp
The
.Fn pthread_spin_init
function may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The
.Fa lock
parameter was NULL or the
.Fa pshared
parameter was neither
.Dv PTHREAD_PROCESS_SHARED
nor
.Dv PTHREAD_PROCESS_PRIVATE .
.El
.Sh SEE ALSO
.Xr pthread_spin_destroy 3 ,
.Xr pthread_spin_lock 3 ,
.Xr pthread_spin_trylock 3 ,
.Xr pthread_spin_unlock 3
.Sh STANDARDS
.Fn pthread_spin_init
conforms to
.St -p1003.1-2001 .

View File

@ -0,0 +1,105 @@
.\" $Header: /cvsroot/src/lib/libpthread/Attic/pthread_spin_lock.3,v 1.1 2003/06/03 21:31:37 nathanw Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" 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. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 January 30, 2003
.Dt PTHREAD_SPIN_LOCK 3
.Os
.Sh NAME
.Nm pthread_spin_lock ,
.Nm pthread_spin_trylock
.Nd acquire a spin lock
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_spin_lock "pthread_spinlock_t *lock"
.Ft int
.Fn pthread_spin_trylock "pthread_spinlock_t *lock"
.Sh DESCRIPTION
The
.Fn pthread_spin_lock
function acquires a spin lock on
.Fa lock
provided that
.Fa lock
is not presently held. If the lock cannot be
immediately acquired, the calling thread repeatedly retries until it can
acquire the lock.
.Pp
The
.Fn pthread_spin_trylock
function performs the same action, but does not block if the lock
cannot be immediately obtained (i.e. the lock is held).
.Sh RETURN VALUES
If successful, the
.Fn pthread_spin_lock
and
.Fn pthread_spin_trylock
functions will return zero. Otherwise an error number will be returned
to indicate the error.
.Sh ERRORS
The
.Fn pthread_spin_trylock
function shall fail if:
.Bl -tag -width Er
.It Bq Er EBUSY
The lock could not be acquired because a writer holds the lock or
was blocked on it.
.El
.Pp
The
.Fn pthread_spin_lock
function may fail if:
.Bl -tag -width Er
.It Bq Er EDEADLK
The current thread already owns
.Fa lock
for writing.
.El
.Pp
The
.Fn pthread_spin_lock
and
.Fn pthread_spin_trylock
functions may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa lock
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_spin_init 3 ,
.Xr pthread_spin_destroy 3 ,
.Xr pthread_spin_unlock 3
.Sh STANDARDS
.Fn pthread_spin_lock
and
.Fn pthread_spin_trylock
conform to
.St -p1003.1-2001 .

View File

@ -0,0 +1,75 @@
.\" $Header: /cvsroot/src/lib/libpthread/Attic/pthread_spin_unlock.3,v 1.1 2003/06/03 21:31:37 nathanw Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" 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. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 January 30, 2003
.Dt PTHREAD_SPIN_UNLOCK 3
.Os
.Sh NAME
.Nm pthread_spin_unlock
.Nd release a spin lock
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_spin_unlock "pthread_spinlock_t *lock"
.Sh DESCRIPTION
The
.Fn pthread_spin_unlock
function is used to release the read/write lock previously obtained by
.Fn pthread_spin_lock
or
.Fn pthread_spin_trylock .
.Sh RETURN VALUES
If successful, the
.Fn pthread_spin_unlock
function will return zero. Otherwise an error number will be returned
to indicate the error.
.Pp
The results are undefined if
.Fa lock
is not held by the calling thread.
.Sh ERRORS
The
.Fn pthread_spin_unlock
function may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa lock
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_spin_init 3
.Xr pthread_spin_destroy 3 ,
.Xr pthread_spin_lock 3 ,
.Xr pthread_spin_trylock 3 ,
.Sh STANDARDS
.Fn pthread_rwlock_unlock
conforms to
.St -p1003.1-2001 .