1PTHREAD_ATTR_SETSCHEDPOLICY(L3i)nux Programmer's ManPuTaHlREAD_ATTR_SETSCHEDPOLICY(3)
2
3
4

NAME

6       pthread_attr_setschedpolicy,   pthread_attr_getschedpolicy   -  set/get
7       scheduling policy attribute in thread attributes object
8

SYNOPSIS

10       #include <pthread.h>
11
12       int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
13       int pthread_attr_getschedpolicy(const pthread_attr_t *restrict attr,
14                                       int *restrict policy);
15
16       Compile and link with -pthread.
17

DESCRIPTION

19       The pthread_attr_setschedpolicy() function sets the  scheduling  policy
20       attribute  of  the  thread attributes object referred to by attr to the
21       value specified in policy.  This attribute  determines  the  scheduling
22       policy of a thread created using the thread attributes object attr.
23
24       The   supported   values  for  policy  are  SCHED_FIFO,  SCHED_RR,  and
25       SCHED_OTHER, with the semantics described in sched(7).
26
27       The pthread_attr_getschedpolicy() returns the scheduling policy  attri‐
28       bute  of  the thread attributes object attr in the buffer pointed to by
29       policy.
30
31       In order for the policy setting made  by  pthread_attr_setschedpolicy()
32       to  have  effect  when  calling  pthread_create(3), the caller must use
33       pthread_attr_setinheritsched(3) to set the inherit-scheduler  attribute
34       of the attributes object attr to PTHREAD_EXPLICIT_SCHED.
35

RETURN VALUE

37       On  success,  these functions return 0; on error, they return a nonzero
38       error number.
39

ERRORS

41       pthread_attr_setschedpolicy() can fail with the following error:
42
43       EINVAL Invalid value in policy.
44
45       POSIX.1 also documents an optional ENOTSUP error ("attempt was made  to
46       set  the attribute to an unsupported value") for pthread_attr_setsched‐
47       policy().
48

ATTRIBUTES

50       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
51       tributes(7).
52
53       ┌────────────────────────────────────────────┬───────────────┬─────────┐
54Interface                                   Attribute     Value   
55       ├────────────────────────────────────────────┼───────────────┼─────────┤
56pthread_attr_setschedpolicy(),              │ Thread safety │ MT-Safe │
57pthread_attr_getschedpolicy()               │               │         │
58       └────────────────────────────────────────────┴───────────────┴─────────┘
59

CONFORMING TO

61       POSIX.1-2001, POSIX.1-2008.
62

EXAMPLES

64       See pthread_setschedparam(3).
65

SEE ALSO

67       pthread_attr_init(3), pthread_attr_setinheritsched(3),
68       pthread_attr_setschedparam(3), pthread_create(3),
69       pthread_setschedparam(3), pthread_setschedprio(3), pthreads(7),
70       sched(7)
71

COLOPHON

73       This page is part of release 5.13 of the Linux man-pages project.  A
74       description of the project, information about reporting bugs, and the
75       latest version of this page, can be found at
76       https://www.kernel.org/doc/man-pages/.
77
78
79
80Linux                             2021-03-22    PTHREAD_ATTR_SETSCHEDPOLICY(3)
Impressum