1pthread_mutexattr_getpsharSetda(n3dCa)rd C Library Funpctthiroenasd_mutexattr_getpshared(3C)
2
3
4

NAME

6       pthread_mutexattr_getpshared, pthread_mutexattr_setpshared - get or set
7       process-shared attribute
8

SYNOPSIS

10       cc -mt [ flag... ] file... -lpthread [ library... ]
11       #include <pthread.h>
12
13       int pthread_mutexattr_getpshared(
14            const pthread_mutexattr_t *restrict attr,
15            int *restrict pshared);
16
17
18       int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
19            int pshared);
20
21

DESCRIPTION

23       The pthread_mutexattr_getpshared() function obtains the  value  of  the
24       process-shared attribute from the attributes object referenced by attr.
25       The pthread_mutexattr_setpshared() function is used to set the process-
26       shared  attribute  in  an  initialized  attributes object referenced by
27       attr.
28
29
30       The process-shared attribute is set to  PTHREAD_PROCESS_SHARED to  per‐
31       mit  a  mutex  to be operated upon by any thread that has access to the
32       memory where the mutex is allocated, even if the mutex is allocated  in
33       memory  that  is  shared  by  multiple processes. If the process-shared
34       attribute is  PTHREAD_PROCESS_PRIVATE, the mutex will only be  operated
35       upon by threads created within the same process as the thread that ini‐
36       tialized the mutex; if threads of differing processes attempt to  oper‐
37       ate  on  such  a mutex, the behavior is undefined. The default value of
38       the attribute is PTHREAD_PROCESS_PRIVATE.
39

RETURN VALUES

41       Upon successful completion, pthread_mutexattr_getpshared()  returns   0
42       and  stores  the value of the process-shared attribute of attr into the
43       object referenced by the pshared parameter. Otherwise, an error  number
44       is returned to indicate the error.
45
46
47       Upon  successful completion, pthread_mutexattr_setpshared() returns  0.
48       Otherwise, an error number is returned to indicate the error.
49

ERRORS

51       The pthread_mutexattr_getpshared()  and  pthread_mutexattr_setpshared()
52       functions may fail if:
53
54       EINVAL    The value specified by attr is invalid.
55
56
57
58       The pthread_mutexattr_setpshared() function may fail if:
59
60       EINVAL    The  new  value  specified  for  the attribute is outside the
61                 range of legal values for that attribute.
62
63

ATTRIBUTES

65       See attributes(5) for descriptions of the following attributes:
66
67
68
69
70       ┌─────────────────────────────┬─────────────────────────────┐
71       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
72       ├─────────────────────────────┼─────────────────────────────┤
73       │Interface Stability          │Standard                     │
74       ├─────────────────────────────┼─────────────────────────────┤
75       │MT-Level                     │MT-Safe                      │
76       └─────────────────────────────┴─────────────────────────────┘
77

SEE ALSO

79       pthread_create(3C), pthread_mutex_init(3C), pthread_mutexattr_init(3C),
80       pthread_cond_init(3C), attributes(5), standards(5)
81
82
83
84SunOS 5.11                        23 Mar 2005 pthread_mutexattr_getpshared(3C)
Impressum