1PTHREAD_ATTR_SETSCHEDPARAM(3L)inux Programmer's ManuPaTlHREAD_ATTR_SETSCHEDPARAM(3)
2
3
4

NAME

6       pthread_attr_setschedparam, pthread_attr_getschedparam - set/get sched‐
7       uling parameter attributes in thread attributes object
8

SYNOPSIS

10       #include <pthread.h>
11
12       int pthread_attr_setschedparam(pthread_attr_t *attr,
13                                      const struct sched_param *param);
14       int pthread_attr_getschedparam(const pthread_attr_t *attr,
15                                      struct sched_param *param);
16
17       Compile and link with -pthread.
18

DESCRIPTION

20       The pthread_attr_setschedparam() function sets the scheduling parameter
21       attributes  of  the thread attributes object referred to by attr to the
22       values specified in the buffer pointed to by param.   These  attributes
23       determine  the  scheduling  parameters  of  a  thread created using the
24       thread attributes object attr.
25
26       The  pthread_attr_getschedparam()  returns  the  scheduling   parameter
27       attributes  of  the thread attributes object attr in the buffer pointed
28       to by param.
29
30       Scheduling parameters are maintained in the following structure:
31
32           struct sched_param {
33               int sched_priority;     /* Scheduling priority */
34           };
35
36       As can be seen,  only  one  scheduling  parameter  is  supported.   For
37       details  of  the  permitted  ranges  for  scheduling priorities in each
38       scheduling policy, see sched(7).
39
40       In order for the parameter setting made by pthread_attr_setschedparam()
41       to  have  effect  when  calling  pthread_create(3), the caller must use
42       pthread_attr_setinheritsched(3) to set the inherit-scheduler  attribute
43       of the attributes object attr to PTHREAD_EXPLICIT_SCHED.
44

RETURN VALUE

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

ERRORS

50       pthread_attr_setschedparam() can fail with the following error:
51
52       EINVAL The priority specified in param does not make sense for the cur‐
53              rent scheduling policy of attr.
54
55       POSIX.1  also  documents  an  ENOTSUP  error for pthread_attr_setsched‐
56       param().  This value is never  returned  on  Linux  (but  portable  and
57       future-proof  applications should nevertheless handle this error return
58       value).
59

ATTRIBUTES

61       For  an  explanation  of  the  terms  used   in   this   section,   see
62       attributes(7).
63
64       ┌──────────────────────────────┬───────────────┬─────────┐
65Interface                     Attribute     Value   
66       ├──────────────────────────────┼───────────────┼─────────┤
67pthread_attr_setschedparam(), │ Thread safety │ MT-Safe │
68pthread_attr_getschedparam()  │               │         │
69       └──────────────────────────────┴───────────────┴─────────┘

CONFORMING TO

71       POSIX.1-2001, POSIX.1-2008.
72

NOTES

74       See pthread_attr_setschedpolicy(3) for a list of the thread  scheduling
75       policies supported on Linux.
76

EXAMPLE

78       See pthread_setschedparam(3).
79

SEE ALSO

81       sched_get_priority_min(2), pthread_attr_init(3),
82       pthread_attr_setinheritsched(3), pthread_attr_setschedpolicy(3),
83       pthread_create(3), pthread_setschedparam(3), pthread_setschedprio(3),
84       pthreads(7), sched(7)
85

COLOPHON

87       This page is part of release 4.16 of the Linux man-pages project.  A
88       description of the project, information about reporting bugs, and the
89       latest version of this page, can be found at
90       https://www.kernel.org/doc/man-pages/.
91
92
93
94Linux                             2017-09-15     PTHREAD_ATTR_SETSCHEDPARAM(3)
Impressum