![]() |
![]() |
![]() |
Control a thread
#include <sys/neutrino.h> int ThreadCtl( int cmd, void * data ); int ThreadCtl_r( int cmd, void * data );
libc
The ThreadCtl() and ThreadCtl_r() functions are identical except in the way they indicate errors. See the Returns section for details.
These kernel calls allow you to make QNX-specific changes to a thread. The following calls are defined:
Threads created by the calling thread do inherit the _NTO_TCTL_IO status.
By default, a thread's runmask is set to all ones, which allows it to run on any available processor. A value of 0x01 would, for example, force the thread to only run on the first processor.
Systems designers can use _NTO_TCTL_RUNMASK to optimize the runtime performance of their system by, for example, relegating nonrealtime threads to a specific processor. In general, this shouldn't be necessary, since the QNX realtime scheduler always preempts a lower-priority thread immediately when a higher priority thread becomes ready.
The main effect of processor locking is the effectiveness of the CPU cache, since threads can be prevented from migrating.
Threads created by the calling thread don't inherit the _NTO_TCTL_RUNMASK status.
Threads created by the calling thread aren't frozen.
The data pointer is reserved for passing extra data for new commands that may be introduced in the future.
These calls don't block.
The only difference between these functions is the way they indicate errors:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
InterruptDisable(), InterruptEnable(), InterruptMask(), InterruptUnmask()
![]() |
![]() |
![]() |