srv_setpri

Description

Modify the scheduling priority of a thread.

Syntax

CS_RETCODE srv_setpri(spp, mode, priority_value)
SRV_PROC        *spp;
CS_INT               mode;
CS_INT             priority_value;

Parameters

spp

A pointer to an internal thread control structure.

mode

SRV_C_DELTAPRI, if priority_value is to adjust the current priority, or SRV_C_NEWPRI, if priority_value is the new priority.

priority_value

If mode is SRV_C_NEWPRI, priority_value is the new priority for the thread. If mode is SRV_C_DELTAPRI, a negative priority_value reduces the current priority by its absolute value and a positive priority_value increases the current priority.

Returns

Table 3-128:  Return values (srv_setpri)

Returns

To indicate

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Examples

Example 1

#include    <ospublic.h>

/*
** Local Prototype.
*/
CS_RETCODE       ex_srv_setpri PROTOTYPE((
SRV_PROC         *spp,
CS_INT           mode,
CS_INT           priority
));

/* 
** EX_SRV_SETPRI
**
**    Example routine to change a thread’s scheduling priority.
**
** Arguments:
**  spp        A pointer to an internal thread control structure.
**  mode       Indicates whether a priority is relative or 
 **              absolute.
**  priority   The change in priority value or the nrew
                 priority value.
**
** Returns:
**
**    CS_SUCCEED
**    CS_FAIL
*/
CS_RETCODE    ex_srv_setpri(spp, mode, priority)
SRV_PROC      *spp;
CS_INT        mode;
CS_INT        priority;
{
    return(srv_setpri(spp, mode, priority));
}

Usage

See also

srv_createproc, srv_spawn