pthread_attr_setschedparam()

set scheduling parameter attribute 

Function


SYNOPSIS

#include <pthread.h>

int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param);


DESCRIPTION

The pthread_attr_setschedparam() function sets the scheduling parameter attribute in the specified attribute object, determined by the scheduling policy specified in the attribute object. The only required member of the param structure for the SCHED_FIFO, SCHED_OTHER, or SCHED_RR policies is sched_priority. This function can be used to specify the starting priority of a newly created thread.

The specified scheduling parameters are only used if the scheduling parameter inheritance attribute is PTHREAD_EXPLICIT_SCHED.


PARAMETERS

attr 

Is a thread attribute object.

param 

Is the thread scheduling parameter attribute value.


RETURN VALUES

On success, pthread_attr_setschedparam() returns 0. On error, one of the following values is returned:

EINVAL 

attr is not an initialized thread attribute object, or param does not specify valid scheduling parameter-settings.

EFAULT 

attr or param is an invalid pointer.


CONFORMANCE

POSIX P1003.1 (1996)


MULTITHREAD SAFETY LEVEL

MT-safe.


PORTING ISSUES

The following table shows the mapping between nice values and Win32 priorities. Refer to the Win32 documentation for SetThreadPriority() for more information on Win32 priority issues.

nice value Win32 Priority
-20 to -16 THREAD_PRIORITY_HIGHEST
-15 to -6 THREAD_PRIORITY_ABOVE_NORMAL
-5 to +4 THREAD_PRIORITY_NORMAL
+5 to +14 THREAD_PRIORITY_BELOW_NORMAL
+15 to +19 THREAD_PRIORITY_LOWEST

This API results in a call to the Windows function SetThreadPriority() and does not adjust the Windows Priority Class. As a result, it is difficult to see that the priority has been changed with the MKS Toolkit ps utility or any other Windows utility (for example, the Windows Task Manager). The priority that has changed is referred to as the "dynamic thread priority" within a priority class and is only displayed by pview or similar utilities.

WARNING

Do not adjust the Windows Priority Class with the Windows SetPriorityClass() API. This can cause NuTCRACKER Platform core data structures to become corrupt and unusable or other undesirable results; all of which could result in the system hanging or worse.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
pthread_attr_getschedparam(), pthread_attr_init(), pthread_attr_setinheritsched(), pthread_attr_setschedpolicy(), pthread_create()


PTC MKS Toolkit 10.4 Documentation Build 39.