1PTHREAD_ATTR_SETINHERITSCHEDL(i3n)ux Programmer's MaPnTuHaRlEAD_ATTR_SETINHERITSCHED(3)
2
3
4
6 pthread_attr_setinheritsched, pthread_attr_getinheritsched - set/get
7 inherit-scheduler attribute in thread attributes object
8
10 #include <pthread.h>
11
12 int pthread_attr_setinheritsched(pthread_attr_t *attr,
13 int inheritsched);
14 int pthread_attr_getinheritsched(pthread_attr_t *attr,
15 int *inheritsched);
16
17 Compile and link with -pthread.
18
20 The pthread_attr_setinheritsched() function sets the inherit-scheduler
21 attribute of the thread attributes object referred to by attr to the
22 value specified in inheritsched. The inherit-scheduler attribute
23 determines whether a thread created using the thread attributes object
24 attr will inherit its scheduling attributes from the calling thread or
25 whether it will take them from attr.
26
27 The following scheduling attributes are affected by the inherit-sched‐
28 uler attribute: scheduling policy (pthread_attr_setschedpolicy(3)),
29 scheduling priority (pthread_attr_setschedparam(3)), and contention
30 scope (pthread_attr_setscope(3)).
31
32 The following values may be specified in inheritsched:
33
34 PTHREAD_INHERIT_SCHED
35 Threads that are created using attr inherit scheduling
36 attributes from the creating thread; the scheduling attributes
37 in attr are ignored.
38
39 PTHREAD_EXPLICIT_SCHED
40 Threads that are created using attr take their scheduling
41 attributes from the values specified by the attributes object.
42
43 The default setting of the inherit-scheduler attribute in a newly ini‐
44 tialized thread attributes object is PTHREAD_INHERIT_SCHED.
45
46 The pthread_attr_getinheritsched() returns the inherit-scheduler
47 attribute of the thread attributes object attr in the buffer pointed to
48 by inheritsched.
49
51 On success, these functions return 0; on error, they return a nonzero
52 error number.
53
55 pthread_attr_setinheritsched() can fail with the following error:
56
57 EINVAL Invalid value in inheritsched.
58
59 POSIX.1-2001 also documents an optional ENOTSUP error ("attempt was
60 made to set the attribute to an unsupported value") for
61 pthread_attr_setinheritsched().
62
64 POSIX.1-2001.
65
67 As at glibc 2.8, if a thread attributes object is initialized using
68 pthread_attr_init(3), then the scheduling policy of the attributes
69 object is set to SCHED_OTHER and the scheduling priority is set to 0.
70 However, if the inherit-scheduler attribute is then set to
71 PTHREAD_EXPLICIT_SCHED, then a thread created using the attribute
72 object wrongly inherits its scheduling attributes from the creating
73 thread. This bug does not occur if either the scheduling policy or
74 scheduling priority attribute is explicitly set in the thread
75 attributes object before calling pthread_create(3).
76
78 See pthread_setschedparam(3).
79
81 sched_setscheduler(2), pthread_attr_init(3),
82 pthread_attr_setschedparam(3), pthread_attr_setschedpolicy(3),
83 pthread_attr_setscope(3), pthread_create(3), pthread_setschedparam(3),
84 pthread_setschedprio(3), pthreads(7)
85
87 This page is part of release 3.53 of the Linux man-pages project. A
88 description of the project, and information about reporting bugs, can
89 be found at http://www.kernel.org/doc/man-pages/.
90
91
92
93Linux 2013-04-19 PTHREAD_ATTR_SETINHERITSCHED(3)