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 *attr, int *policy);
14
15       Compile and link with -pthread.
16

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

ATTRIBUTES

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

CONFORMING TO

59       POSIX.1-2001, POSIX.1-2008.
60

EXAMPLE

62       See pthread_setschedparam(3).
63

SEE ALSO

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

COLOPHON

71       This page is part of release 5.02 of the Linux man-pages project.  A
72       description of the project, information about reporting bugs, and the
73       latest version of this page, can be found at
74       https://www.kernel.org/doc/man-pages/.
75
76
77
78Linux                             2017-09-15    PTHREAD_ATTR_SETSCHEDPOLICY(3)
Impressum