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(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_setscheduler(2).
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       POSIX.1 documents EINVAL and ENOTSUP errors for  pthread_attr_setsched‐
51       param().   On  Linux  these  functions always succeed (but portable and
52       future-proof applications should nevertheless handle a  possible  error
53       return).
54

CONFORMING TO

56       POSIX.1-2001.
57

NOTES

59       See  pthread_attr_setschedpolicy(3) for a list of the thread scheduling
60       policies supported on Linux.
61

EXAMPLE

63       See pthread_setschedparam(3).
64

SEE ALSO

66       sched_get_priority_min(2), sched_setscheduler(2), pthread_attr_init(3),
67       pthread_attr_setinheritsched(3), pthread_attr_setschedpolicy(3),
68       pthread_create(3), pthread_setschedparam(3), pthread_setschedprio(3),
69       pthreads(7)
70

COLOPHON

72       This page is part of release 3.53 of the Linux man-pages project.  A
73       description of the project, and information about reporting bugs, can
74       be found at http://www.kernel.org/doc/man-pages/.
75
76
77
78Linux                             2013-06-21     PTHREAD_ATTR_SETSCHEDPARAM(3)
Impressum