Control a thread
#include <sys/neutrino.h>
int ThreadCtl( int cmd,
void * data );
int ThreadCtl_r( int cmd,
void * data );
libc
These kernel calls allow you to make QNX-specific changes to a thread.
The ThreadCtl() and ThreadCtl_r() functions are identical except in the way they indicate errors. See the Returns section for details.
The following calls are defined:
The function sets data to a positive or negative number, indicating the previous state of the the alignment-fault handling.
![]() |
Threads created by the calling thread 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.
You can use _NTO_TCTL_RUNMASK to optimize the runtime performance of your 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()