1PTHREAD_ATTR_GETSCHEDPARAM(3PPO)SIX Programmer's ManPuTaHlREAD_ATTR_GETSCHEDPARAM(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       pthread_attr_getschedparam, pthread_attr_setschedparam —  get  and  set
13       the schedparam attribute
14

SYNOPSIS

16       #include <pthread.h>
17
18       int pthread_attr_getschedparam(const pthread_attr_t *restrict attr,
19           struct sched_param *restrict param);
20       int pthread_attr_setschedparam(pthread_attr_t *restrict attr,
21           const struct sched_param *restrict param);
22

DESCRIPTION

24       The pthread_attr_getschedparam() and pthread_attr_setschedparam() func‐
25       tions,  respectively,  shall  get  and  set  the  scheduling  parameter
26       attributes  in  the  attr argument. The contents of the param structure
27       are defined in the <sched.h> header. For the  SCHED_FIFO  and  SCHED_RR
28       policies, the only required member of param is sched_priority.
29
30       For the SCHED_SPORADIC policy, the required members of the param struc‐
31       ture are sched_priority,  sched_ss_low_priority,  sched_ss_repl_period,
32       sched_ss_init_budget,    and    sched_ss_max_repl.     The    specified
33       sched_ss_repl_period must be greater than or  equal  to  the  specified
34       sched_ss_init_budget  for  the  function to succeed; if it is not, then
35       the function shall fail. The value of sched_ss_max_repl shall be within
36       the  inclusive  range [1,{SS_REPL_MAX}] for the function to succeed; if
37       not,  the  function  shall  fail.   It  is  unspecified   whether   the
38       sched_ss_repl_period and sched_ss_init_budget values are stored as pro‐
39       vided by this function or are rounded to align with the  resolution  of
40       the clock being used.
41
42       The  behavior  is undefined if the value specified by the attr argument
43       to pthread_attr_getschedparam()  or  pthread_attr_setschedparam()  does
44       not refer to an initialized thread attributes object.
45

RETURN VALUE

47       If      successful,      the      pthread_attr_getschedparam()      and
48       pthread_attr_setschedparam() functions shall return zero; otherwise, an
49       error number shall be returned to indicate the error.
50

ERRORS

52       The pthread_attr_setschedparam() function shall fail if:
53
54       ENOTSUP
55              An  attempt  was  made  to  set  the attribute to an unsupported
56              value.
57
58       The pthread_attr_setschedparam() function may fail if:
59
60       EINVAL The value of param is not valid.
61
62       These functions shall not return an error code of [EINTR].
63
64       The following sections are informative.
65

EXAMPLES

67       None.
68

APPLICATION USAGE

70       After these attributes have been set, a thread can be created with  the
71       specified attributes using pthread_create().  Using these routines does
72       not affect the current running thread.
73

RATIONALE

75       If an implementation detects that the value specified by the attr argu‐
76       ment  to  pthread_attr_getschedparam()  or pthread_attr_setschedparam()
77       does not refer to an initialized thread attributes object, it is recom‐
78       mended that the function should fail and report an [EINVAL] error.
79

FUTURE DIRECTIONS

81       None.
82

SEE ALSO

84       pthread_attr_destroy(), pthread_attr_getscope(), pthread_attr_getinher‐
85       itsched(), pthread_attr_getschedpolicy(), pthread_create()
86
87       The Base Definitions volume of POSIX.1‐2017, <pthread.h>, <sched.h>
88
90       Portions of this text are reprinted and reproduced in  electronic  form
91       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
92       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
93       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
94       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
95       event of any discrepancy between this version and the original IEEE and
96       The Open Group Standard, the original IEEE and The Open Group  Standard
97       is  the  referee document. The original Standard can be obtained online
98       at http://www.opengroup.org/unix/online.html .
99
100       Any typographical or formatting errors that appear  in  this  page  are
101       most likely to have been introduced during the conversion of the source
102       files to man page format. To report such errors,  see  https://www.ker
103       nel.org/doc/man-pages/reporting_bugs.html .
104
105
106
107IEEE/The Open Group                  2017       PTHREAD_ATTR_GETSCHEDPARAM(3P)
Impressum