1pthread_mutexattr_init(3C)Standard C Library Functionspthread_mutexattr_init(3C)
2
3
4
6 pthread_mutexattr_init, pthread_mutexattr_destroy - initialize or
7 destroy mutex attributes object
8
10 cc -mt [ flag... ] file... -lpthread [ library... ]
11 #include <pthread.h>
12
13 int pthread_mutexattr_init(pthread_mutexattr_t *attr);
14
15
16 int pthread_mutexattr_destroy(pthread_mutexattr_t *attr);
17
18
20 The pthread_mutexattr_init() function initializes a mutex attributes
21 object attr with the default value for all of the attributes defined by
22 the implementation.
23
24
25 The effect of initializing an already initialized mutex attributes
26 object is undefined.
27
28
29 After a mutex attributes object has been used to initialize one or more
30 mutexes, any function affecting the attributes object (including
31 destruction) does not affect any previously initialized mutexes.
32
33
34 The pthread_mutexattr_destroy() function destroys a mutex attributes
35 object; the object becomes, in effect, uninitialized. An implementation
36 may cause pthread_mutexattr_destroy() to set the object referenced by
37 attr to an invalid value. A destroyed mutex attributes object can be
38 re-initialized using pthread_mutexattr_init(); the results of otherwise
39 referencing the object after it has been destroyed are undefined.
40
42 Upon successful completion, pthread_mutexattr_init() and pthread_mutex‐
43 attr_destroy() return 0. Otherwise, an error number is returned to
44 indicate the error.
45
47 The pthread_mutexattr_init() function may fail if:
48
49 ENOMEM Insufficient memory exists to initialize the mutex attributes
50 object.
51
52
53
54 The pthread_mutexattr_destroy() function may fail if:
55
56 EINVAL The value specified by attr is invalid.
57
58
60 See attributes(5) for descriptions of the following attributes:
61
62
63
64
65 ┌─────────────────────────────┬─────────────────────────────┐
66 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
67 ├─────────────────────────────┼─────────────────────────────┤
68 │Interface Stability │Standard │
69 ├─────────────────────────────┼─────────────────────────────┤
70 │MT-Level │MT-Safe │
71 └─────────────────────────────┴─────────────────────────────┘
72
74 pthread_cond_init(3C), pthread_create(3C), pthread_mutex_init(3C),
75 pthread_mutexattr_settype(3C), attributes(5), standards(5)
76
77
78
79SunOS 5.11 23 Mar 2005 pthread_mutexattr_init(3C)