1PTHREAD_ATTR_SETINHERITSCHEDL(i3n)ux Programmer's MaPnTuHaRlEAD_ATTR_SETINHERITSCHED(3)
2
3
4

NAME

6       pthread_attr_setinheritsched,  pthread_attr_getinheritsched  -  set/get
7       inherit scheduler attribute in thread attributes object
8

SYNOPSIS

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

DESCRIPTION

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 values may be specified in inheritsched:
28
29       PTHREAD_INHERIT_SCHED
30              Threads   that   are   created  using  attr  inherit  scheduling
31              attributes from the creating thread; the  scheduling  attributes
32              in attr are ignored.
33
34       PTHREAD_EXPLICIT_SCHED
35              Threads  that  are  created  using  attr  take  their scheduling
36              attributes from the values specified by the attributes object.
37
38       The default setting of the inherit scheduler attribute in a newly  ini‐
39       tialized thread attributes object is PTHREAD_INHERIT_SCHED.
40
41       The   pthread_attr_getinheritsched()   returns  the  inherit  scheduler
42       attribute of the thread attributes object attr in the buffer pointed to
43       by inheritsched.
44

RETURN VALUE

46       On  success,  these functions return 0; on error, they return a nonzero
47       error number.
48

ERRORS

50       pthread_attr_setinheritsched() can fail with the following error:
51
52       EINVAL Invalid value in inheritsched.
53
54       POSIX.1-2001 also documents an optional  ENOTSUP  error  ("attempt  was
55       made   to   set   the   attribute   to   an   unsupported  value")  for
56       pthread_attr_setinheritsched().
57

CONFORMING TO

59       POSIX.1-2001.
60

EXAMPLE

62       See pthread_setschedparam(3).
63

BUGS

65       As at glibc 2.8, if a thread attributes  object  is  initialized  using
66       pthread_attr_init(3),  then  the  scheduling  policy  of the attributes
67       object is set to SCHED_OTHER and the scheduling priority is set  to  0.
68       However,   if   the   inherit   scheduler  attribute  is  then  set  to
69       PTHREAD_EXPLICIT_SCHED, then  a  thread  created  using  the  attribute
70       object  wrongly  inherits  its  scheduling attributes from the creating
71       thread.  This bug does not occur if either  the  scheduling  policy  or
72       scheduling   priority   attribute  is  explicitly  set  in  the  thread
73       attributes object before calling pthread_create(3).
74

SEE ALSO

76       sched_setscheduler(2),   pthread_attr_init(3),   pthread_attr_setsched‐
77       param(3),       pthread_attr_setschedpolicy(3),      pthread_create(3),
78       pthread_setschedparam(3), pthread_setschedprio(3), pthreads(7)
79

COLOPHON

81       This page is part of release 3.25 of the Linux  man-pages  project.   A
82       description  of  the project, and information about reporting bugs, can
83       be found at http://www.kernel.org/doc/man-pages/.
84
85
86
87Linux                             2008-11-10   PTHREAD_ATTR_SETINHERITSCHED(3)
Impressum