HPlogo HP-UX Reference Volume 4 of 5 > p

pthread_getschedparam(3T)

Pthread Library
» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

pthread_setschedparam(), pthread_getschedparam() — set or get the scheduling policy and associated parameters

SYNOPSIS

#include <pthread.h>

int pthread_getschedparam( pthread_t thread, int *policy, struct sched_param *param );

int pthread_setschedparam( pthread_t thread, int policy, const struct sched_param *param );

PARAMETERS

thread

The thread whose scheduling policy and associated parameters are to be set/retrieved.

policy

This parameter either points to the memory location where the scheduling policy of thread is returned (get function) or it specifies the new value of the scheduling policy for thread (set function).

param

This parameter either points to the memory location where the scheduling parameters of thread are returned (get function) or it specifies the new scheduling parameters for thread (set function).

DESCRIPTION

These functions allow the scheduling policy and associated parameters of threads within a multithreaded process to be retrieved and changed. The legal values for the scheduling policy and associated scheduling parameters are defined in <sched.h>.

pthread_setschedparam() changes the scheduling policy and associated scheduling parameters for thread to the policy and the associated parameters provided in policy and param, respectively. On HP-UX, appropriate privileges are required to change the scheduling parameters of a thread. The calling process must have appropriate privileges or be a member of a group having PRIV_RTSCHED access to successfully call pthread_setschedparam().

The pthread_getschedparam() function retrieves the scheduling policy and associated parameters for thread and stores those values in policy and param, respectively. The values returned represent the actual scheduling values, not any temporary values that may be in effect due to priority inheritance or priority ceiling features.

RETURN VALUE

Upon successful completion, pthread_setschedparam() and pthread_getschedparam() return zero. Otherwise, an error number is returned to indicate the error (the errno variable is not set).

ERRORS

If any of the following occur, the pthread_getschedparam() and pthread_setschedparam() functions return the corresponding error number:

[ENOSYS]

_POSIX_THREAD_PRIORITY_SCHEDULING is not defined and these functions are not supported.

For each of the following conditions, if the condition is detected, the pthread_setschedparam() function returns the corresponding error number:

[EINVAL]

policy or one of the scheduling parameters in param is invalid.

[ENOTSUP]

Either the policy or scheduling parameters contain an unsupported value.

[EPERM]

The caller does not have permission to set either the scheduling policy specified in policy or the scheduling parameters specified in param for thread.

[ESRCH]

No thread could be found corresponding to thread.

For each of the following conditions, if the condition is detected, the pthread_getschedparam() function returns the corresponding error number:

[ESRCH]

No thread could be found corresponding to thread.

[EINVAL]

The value specified by policy or param is invalid.

NOTES

For the SCHED_FIFO and SCHED_RR scheduling policies, only the sched_priority member of the sched_param structure is required in the associated scheduling parameters. All other scheduling policies have implementation-defined scheduling policies. Refer to the documentation for rtsched(2) and <sched.h> for further information on implementation-defined scheduling policies.

AUTHOR

pthread_getschedparam() and pthread_setschedparam() were derived from the IEEE POSIX P1003.1c standard.

SEE ALSO

pthread_attr_setschedparam(3T), pthread_attr_setschedpolicy(3T), pthread_attr_getschedparam(3T), pthread_attr_getschedpolicy(3T), rtsched(2).

STANDARDS CONFORMANCE

pthread_getschedparam(): POSIX 1003.1c. pthread_setschedparam(): POSIX 1003.1c.

© Hewlett-Packard Development Company, L.P.