Xenomai  3.1
Scheduling management

Cobalt scheduling management services. More...

Collaboration diagram for Scheduling management:

Functions

int pthread_setschedparam (pthread_t thread, int policy, const struct sched_param *param)
 
Set the scheduling policy and parameters of the specified thread. More...
 
int pthread_setschedparam_ex (pthread_t thread, int policy, const struct sched_param_ex *param_ex)
 
Set extended scheduling policy of thread More...
 
int pthread_getschedparam (pthread_t thread, int *__restrict__ policy, struct sched_param *__restrict__ param)
 
Get the scheduling policy and parameters of the specified thread. More...
 
int pthread_getschedparam_ex (pthread_t thread, int *__restrict__ policy_r, struct sched_param_ex *__restrict__ param_ex)
 
Get extended scheduling policy of thread More...
 
int pthread_yield (void)
 
Yield the processor. More...
 

Detailed Description

Cobalt scheduling management services.

Function Documentation

◆ pthread_getschedparam()

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


Get the scheduling policy and parameters of the specified thread.

This service returns, at the addresses policy and par, the current scheduling policy and scheduling parameters (i.e. priority) of the Cobalt thread tid. If thread is not the identifier of a Cobalt thread, this service fallback to the regular POSIX pthread_getschedparam() service.

Parameters
threadtarget thread;
policyaddress where the scheduling policy of tid is stored on success;
paramaddress where the scheduling parameters of tid is stored on success.
Returns
0 on success;
an error number if:
  • ESRCH, tid is invalid.
See also
Specification.
Tags
thread-unrestricted

Referenced by pthread_getschedparam_ex().

◆ pthread_getschedparam_ex()

int pthread_getschedparam_ex ( pthread_t  thread,
int *__restrict__  policy_r,
struct sched_param_ex *__restrict__  param_ex 
)


Get extended scheduling policy of thread

This service is an extended version of the regular pthread_getschedparam() service, which also supports Cobalt-specific policies, not available with the host Linux environment.

Parameters
threadtarget thread;
policy_raddress where the scheduling policy of thread is stored on success;
param_exaddress where the scheduling parameters of thread are stored on success.
Returns
0 on success;
an error number if:
  • ESRCH, thread is invalid.
See also
Specification.
Tags
thread-unrestricted

References pthread_getschedparam().

◆ pthread_setschedparam()

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


Set the scheduling policy and parameters of the specified thread.

This service set the scheduling policy of the Cobalt thread identified by pid to the value policy, and its scheduling parameters (i.e. its priority) to the value pointed to by param.

If pthread_self() is passed, this service turns the current thread into a Cobalt thread. If thread is not the identifier of a Cobalt thread, this service falls back to the regular pthread_setschedparam() service.

Parameters
threadtarget Cobalt thread;
policyscheduling policy, one of SCHED_FIFO, SCHED_RR, or SCHED_OTHER;
paramaddress of scheduling parameters.
Returns
0 on success;
an error number if:
  • ESRCH, pid is invalid;
  • EINVAL, policy or param->sched_priority is invalid;
  • EAGAIN, insufficient memory available from the system heap, increase CONFIG_XENO_OPT_SYS_HEAPSZ;
  • EFAULT, param is an invalid address;
See also
Specification.
Note

See pthread_create(), pthread_setschedparam_ex().

Tags
thread-unrestricted, switch-secondary, switch-primary

Referenced by pthread_setschedparam_ex().

◆ pthread_setschedparam_ex()

int pthread_setschedparam_ex ( pthread_t  thread,
int  policy,
const struct sched_param_ex *  param_ex 
)


Set extended scheduling policy of thread

This service is an extended version of the regular pthread_setschedparam() service, which supports Cobalt-specific scheduling policies, not available with the host Linux environment.

This service set the scheduling policy of the Cobalt thread thread to the value policy, and its scheduling parameters (e.g. its priority) to the value pointed to by param_ex.

If thread does not match the identifier of a Cobalt thread, this action falls back to the regular pthread_setschedparam() service.

Parameters
threadtarget Cobalt thread;
policyscheduling policy, one of SCHED_WEAK, SCHED_FIFO, SCHED_COBALT, SCHED_RR, SCHED_SPORADIC, SCHED_TP, SCHED_QUOTA or SCHED_NORMAL;
param_exscheduling parameters address. As a special exception, a negative sched_priority value is interpreted as if SCHED_WEAK was given in policy, using the absolute value of this parameter as the weak priority level.

When CONFIG_XENO_OPT_SCHED_WEAK is enabled, SCHED_WEAK exhibits priority levels in the [0..99] range (inclusive). Otherwise, sched_priority must be zero for the SCHED_WEAK policy.

Returns
0 on success;
an error number if:
  • ESRCH, thread is invalid;
  • EINVAL, policy or param_ex->sched_priority is invalid;
  • EAGAIN, insufficient memory available from the system heap, increase CONFIG_XENO_OPT_SYS_HEAPSZ;
  • EFAULT, param_ex is an invalid address;
  • EPERM, the calling process does not have superuser permissions.
See also
Specification.
Note

See pthread_create(), pthread_setschedparam().

Tags
thread-unrestricted, switch-secondary, switch-primary

References pthread_setschedparam().

◆ pthread_yield()

int pthread_yield ( void  )


Yield the processor.

This function move the current thread at the end of its priority group.

Return values
0
See also
Specification.
Tags
thread-unrestricted, switch-primary