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