Blame man3/pthread_mutexattr_getpshared.3

Packit 7cfc04
.\" Copyright (c) 2017, Michael Kerrisk <mtk.manpages@gmail.com>
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(VERBATIM)
Packit 7cfc04
.\" Permission is granted to make and distribute verbatim copies of this
Packit 7cfc04
.\" manual provided the copyright notice and this permission notice are
Packit 7cfc04
.\" preserved on all copies.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Permission is granted to copy and distribute modified versions of this
Packit 7cfc04
.\" manual under the conditions for verbatim copying, provided that the
Packit 7cfc04
.\" entire resulting derived work is distributed under the terms of a
Packit 7cfc04
.\" permission notice identical to this one.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Since the Linux kernel and libraries are constantly changing, this
Packit 7cfc04
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
Packit 7cfc04
.\" responsibility for errors or omissions, or for damages resulting from
Packit 7cfc04
.\" the use of the information contained herein.  The author(s) may not
Packit 7cfc04
.\" have taken the same level of care in the production of this manual,
Packit 7cfc04
.\" which is licensed free of charge, as they might when working
Packit 7cfc04
.\" professionally.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Formatted or processed versions of this manual, if unaccompanied by
Packit 7cfc04
.\" the source, must acknowledge the copyright and authors of this work.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.TH PTHREAD_MUTEXATTR_GETPSHARED 3 2017-09-13 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
pthread_mutexattr_getpshared, pthread_mutexattr_setpshared \- get/set
Packit 7cfc04
process-shared mutex attribute
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B #include <pthread.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int pthread_mutexattr_getpshared(const pthread_mutexattr_t *" attr ,
Packit 7cfc04
.BI "                                 int *" pshared );
Packit 7cfc04
.BI "int pthread_mutexattr_setpshared(pthread_mutexattr_t *" attr ,
Packit 7cfc04
.BI "                                 int " pshared );
Packit 7cfc04
.fi
Packit 7cfc04
.PP
Packit 7cfc04
Compile and link with \fI\-pthread\fP.
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
These functions get and set the process-shared attribute
Packit 7cfc04
in a mutex attributes object.
Packit 7cfc04
This attribute must be appropriately set to ensure correct,
Packit 7cfc04
efficient operation of a mutex created using this attributes object.
Packit 7cfc04
.PP
Packit 7cfc04
The process-shared attribute can have one of the following values:
Packit 7cfc04
.TP
Packit 7cfc04
.B PTHREAD_PROCESS_PRIVATE
Packit 7cfc04
Mutexes created with this attributes object are to be shared
Packit 7cfc04
only among threads in the same process that initialized the mutex.
Packit 7cfc04
This is the default value for the process-shared mutex attribute.
Packit 7cfc04
.TP
Packit 7cfc04
.B PTHREAD_PROCESS_SHARED
Packit 7cfc04
Mutexes created with this attributes object can be shared between
Packit 7cfc04
any threads that have access to the memory containing the object,
Packit 7cfc04
including threads in different processes.
Packit 7cfc04
.PP
Packit 7cfc04
.BR pthread_mutexattr_getpshared ()
Packit 7cfc04
places the value of the process-shared attribute of
Packit 7cfc04
the mutex attributes object referred to by
Packit 7cfc04
.IR attr
Packit 7cfc04
in the location pointed to by
Packit 7cfc04
.IR pshared .
Packit 7cfc04
.PP
Packit 7cfc04
.BR pthread_mutexattr_setpshared ()
Packit 7cfc04
sets the value of the process-shared attribute of
Packit 7cfc04
the mutex attributes object referred to by
Packit 7cfc04
.IR attr
Packit 7cfc04
to the value specified in
Packit 7cfc04
.BR pshared .
Packit 7cfc04
.PP
Packit 7cfc04
If
Packit 7cfc04
.I attr
Packit 7cfc04
does not refer to an initialized mutex attributes object,
Packit 7cfc04
the behavior is undefined.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
On success, these functions return 0.
Packit 7cfc04
On error, they return a positive error number.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
.BR pthread_mutexattr_setpshared ()
Packit 7cfc04
can fail with the following errors:
Packit 7cfc04
.TP
Packit 7cfc04
.B EINVAL
Packit 7cfc04
The value specified in
Packit 7cfc04
.I pshared
Packit 7cfc04
is invalid.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENOTSUP
Packit 7cfc04
.I pshared is
Packit 7cfc04
.BR PTHREAD_PROCESS_SHARED
Packit 7cfc04
but the implementation does not support process-shared mutexes.
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
POSIX.1-2001, POSIX.1-2008.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.ad l
Packit 7cfc04
.nh
Packit 7cfc04
.BR pthread_mutexattr_init (3),
Packit 7cfc04
.BR pthreads (7)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.