| 1 |
.\" Copyright 2017, Michael Kerrisk <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH pthread_mutexattr_init 3 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
pthread_mutexattr_init, pthread_mutexattr_destroy \- initialize and |
| 9 |
destroy a mutex attributes object |
| 10 |
.SH LIBRARY |
| 11 |
POSIX threads library |
| 12 |
.RI ( libpthread ,\~ \-lpthread ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <pthread.h> |
| 16 |
.P |
| 17 |
.BI "int pthread_mutexattr_init(pthread_mutexattr_t *" attr ");" |
| 18 |
.BI "int pthread_mutexattr_destroy(pthread_mutexattr_t *" attr ");" |
| 19 |
.fi |
| 20 |
.SH DESCRIPTION |
| 21 |
The |
| 22 |
.BR pthread_mutexattr_init () |
| 23 |
function initializes the mutex attributes object pointed to by |
| 24 |
.I attr |
| 25 |
with default values for all attributes defined by the implementation. |
| 26 |
.P |
| 27 |
The results of initializing an already initialized mutex attributes |
| 28 |
object are undefined. |
| 29 |
.P |
| 30 |
The |
| 31 |
.BR pthread_mutexattr_destroy () |
| 32 |
function destroys a mutex attribute object (making it uninitialized). |
| 33 |
Once a mutex attributes object has been destroyed, it can be reinitialized with |
| 34 |
.BR pthread_mutexattr_init (). |
| 35 |
.P |
| 36 |
The results of destroying an uninitialized mutex attributes |
| 37 |
object are undefined. |
| 38 |
.SH RETURN VALUE |
| 39 |
On success, these functions return 0. |
| 40 |
On error, they return a positive error number. |
| 41 |
.SH STANDARDS |
| 42 |
POSIX.1-2008. |
| 43 |
.SH HISTORY |
| 44 |
POSIX.1-2001. |
| 45 |
.SH NOTES |
| 46 |
Subsequent changes to a mutex attributes object do not affect mutex that |
| 47 |
have already been initialized using that object. |
| 48 |
.SH SEE ALSO |
| 49 |
.ad l |
| 50 |
.nh |
| 51 |
.BR pthread_mutex_init (3), |
| 52 |
.BR pthread_mutexattr_getpshared (3), |
| 53 |
.BR pthread_mutexattr_getrobust (3), |
| 54 |
.BR pthreads (7) |