1pthread_attr_setschedpolicy(L3i)brary Functions Manupatlhread_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

LIBRARY

10       POSIX threads library (libpthread, -lpthread)
11

SYNOPSIS

13       #include <pthread.h>
14
15       int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
16       int pthread_attr_getschedpolicy(const pthread_attr_t *restrict attr,
17                                       int *restrict policy);
18

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

ATTRIBUTES

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

STANDARDS

62       POSIX.1-2008.
63

HISTORY

65       glibc 2.0.  POSIX.1-2001.
66

EXAMPLES

68       See pthread_setschedparam(3).
69

SEE ALSO

71       pthread_attr_init(3), pthread_attr_setinheritsched(3),
72       pthread_attr_setschedparam(3), pthread_create(3),
73       pthread_setschedparam(3), pthread_setschedprio(3), pthreads(7),
74       sched(7)
75
76
77
78Linux man-pages 6.04              2023-03-30    pthread_attr_setschedpolicy(3)
Impressum