mirror of https://github.com/mkerrisk/man-pages
pthread_mutexattr_setrobust.3: Minor fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
8524bca574
commit
143e516fbd
|
@ -26,7 +26,7 @@
|
|||
.TH PTHREAD_MUTEXATTR_SETROBUST 3 2017-08-20 "Linux" "Linux Programmer's Manual"
|
||||
.SH NAME
|
||||
pthread_mutexattr_getrobust, pthread_mutexattr_setrobust
|
||||
\- get and set the robustness attribute of a mutex attribute object
|
||||
\- get and set the robustness attribute of a mutex attributes object
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.B #include <pthread.h>
|
||||
|
@ -57,13 +57,15 @@ _POSIX_C_SOURCE >= 200809L
|
|||
.SH DESCRIPTION
|
||||
The
|
||||
.BR pthread_mutexattr_getrobust ()
|
||||
places the value of the robustness attribute of the mutex referred to by
|
||||
places the value of the robustness attribute of
|
||||
the mutex attributes object referred to by
|
||||
.I attr
|
||||
in
|
||||
.IR *robustness .
|
||||
The
|
||||
.BR pthread_mutexattr_setrobust ()
|
||||
sets the value of the robustness attribute of the mutex referred to by
|
||||
sets the value of the robustness attribute of
|
||||
the mutex attributes object referred to by
|
||||
.I attr
|
||||
to the value specified in
|
||||
.IR *robustness .
|
||||
|
@ -74,7 +76,7 @@ The following values are valid for
|
|||
.IR robustness :
|
||||
.TP
|
||||
.BR PTHREAD_MUTEX_STALLED
|
||||
This is the default value for a mutex attribute object.
|
||||
This is the default value for a mutex attributes object.
|
||||
If a mutex is initialized with the
|
||||
.BR PTHREAD_MUTEX_STALLED
|
||||
attribute and its owner dies without unlocking it,
|
||||
|
@ -123,7 +125,7 @@ argument of
|
|||
.BR pthread_mutexattr_getrobust ()
|
||||
and
|
||||
.BR pthread_mutexattr_setrobust ()
|
||||
should refer to a mutex attribute object that was initialized by
|
||||
should refer to a mutex attributes object that was initialized by
|
||||
.BR pthread_mutexattr_init (3),
|
||||
otherwise the behavior is undefined.
|
||||
.SH RETURN VALUE
|
||||
|
@ -176,8 +178,8 @@ These GNU-specific APIs, which first appeared in glibc 2.4,
|
|||
are nowadays obsolete and should not be used in new programs.
|
||||
.SH EXAMPLE
|
||||
.PP
|
||||
The program demonstrates a simple use of the robustness attribute of a
|
||||
pthread mutex attribute object.
|
||||
The program demonstrates the use of the robustness attribute of a
|
||||
mutex attributes object.
|
||||
In this program, a thread holding the mutex
|
||||
dies prematurely without unlocking the mutex.
|
||||
The main thread subsequently acquires the mutex
|
||||
|
@ -227,9 +229,10 @@ main(int argc, char *argv[])
|
|||
pthread_mutexattr_t attr;
|
||||
int s;
|
||||
|
||||
pthread_mutexattr_init(&attr); /* initialize the attribute object */
|
||||
pthread_mutexattr_init(&attr);
|
||||
/* initialize the attributes object */
|
||||
pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST);
|
||||
/* set robustness */
|
||||
/* set robustness */
|
||||
|
||||
pthread_mutex_init(&mtx, &attr); /* initialize the mutex */
|
||||
|
||||
|
|
Loading…
Reference in New Issue