Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedset.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedset.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedset.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedset.html on line 8
Set the scheduling policy for a thread
#include <sys/neutrino.h>
int SchedSet(
pid_t pid,
int tid,
int policy,
const struct sched_param *param );
int SchedSet_r(
pid_t pid,
int tid,
int policy,
const struct sched_param *param );
- pid
- 0 or a process ID; see below.
- tid
- 0 or a thread ID; see below.
- policy
- The scheduling policy; one of:
- SCHED_FIFO — a fixed-priority scheduler in which
the highest priority, ready thread runs until it blocks or is preempted
by a higher priority thread.
- SCHED_RR — the same as SCHED_FIFO,
except threads at the same priority level timeslice (round robin) every
4 × the clock period (see
ClockPeriod()).
- SCHED_OTHER — currently the same as
SCHED_RR.
- SCHED_SPORADIC — sporadic scheduling.
- SCHED_NOCHANGE — this isn't actually a policy,
but a special value that tells the kernel to update the parameters
specified in param, without changing the policy.
- SCHED_ADJTOHEAD — puts pid and tid
at the head of the READY queue if they are in a READY state.
- SCHED_ADJTOTAIL — puts pid and tid
at the tail of the READY queue if they are in a READY state.
|
If either the SCHED_ADJTOHEAD or SCHED_ADJTOTAIL
options is set, then the struct sched_param field is ignored.
|
For more information, see
“Thread scheduling”
in the QNX Neutrino Microkernel chapter of the
System Architecture guide.
- param
- A pointer to a
sched_param
structure where the function can store the scheduling parameters.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The SchedSet() and SchedSet_r()
kernel calls set both the scheduling
policy and the associated parameters for the thread specified by
tid in the process specified by pid. If
pid is zero the current process is used to look up a nonzero
tid. If tid is zero, then the calling thread is
used and pid is ignored.
These functions are identical
except in the way they indicate errors.
See the Returns section for details.
These calls don't block.
The only difference between these functions is the way they indicate errors:
- SchedSet()
- If an error occurs, -1 is returned and
errno
is set.
Any other value returned indicates success.
- SchedSet_r()
- EOK is returned on success.
This function does NOT set errno.
If an error occurs, any value in the Errors section may be returned.
- EFAULT
- A fault occurred when the kernel tried to access the buffers you provided.
- EINVAL
- The given scheduling policy is invalid.
- EPERM
- The process doesn't have permission to change the scheduling of the indicated thread.
- ESRCH
- The process indicated by pid or thread indicated by tid doesn't exist.
QNX Neutrino
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
pthread_setschedparam(),
sched_get_priority_max(),
sched_get_priority_min(),
sched_param,
SchedGet(),
SchedInfo(),
SchedYield()
“Thread scheduling”
in the QNX Neutrino Microkernel chapter of the
System Architecture guide
“Scheduling algorithms”
in the Programming Overview chapter of the
QNX Neutrino Programmer's Guide
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedset.html on line 271
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedset.html on line 271