![]() |
CMSIS-RTOS
Version 1.02
CMSIS-RTOS API: Generic RTOS interface for Cortex-M processor-based devices.
|
Control or wait for signal flags. More...
Macros | |
#define | osFeature_Signals 8 |
maximum number of Signal Flags available per thread | |
Functions | |
int32_t | osSignalSet (osThreadId thread_id, int32_t signals) |
Set the specified Signal Flags of an active thread. | |
int32_t | osSignalClear (osThreadId thread_id, int32_t signals) |
Clear the specified Signal Flags of an active thread. | |
osEvent | osSignalWait (int32_t signals, uint32_t millisec) |
Wait for one or more Signal Flags to become signaled for the current RUNNING thread. | |
Signals are used to trigger execution states between threads. The Signal Management function group allows you to control or wait for signal flags. Each thread has up to 31 assigned signal flags. The maximum number of signal flags is defined in the cmsis_os.h file (#define osFeature_Signals).
A thread can wait for signals to be set (using osSignalWait). A thread may set one or more flags in any other given thread (using osSignalSet). Also, a thread may clear its own signals or the signals of other threads (using osSignalClear). When a thread wakes up and resumes execution, its signal flags are automatically cleared.
#define osFeature_Signals 8 |
The CMSIS-RTOS API may support a variable number of signal flags. This define specifies the number of signal flags available per thread. The maximum value is 32 signal flags per thread.
int32_t osSignalClear | ( | osThreadId | thread_id, |
int32_t | signals | ||
) |
[in] | thread_id | thread ID obtained by osThreadCreate or osThreadGetId. |
[in] | signals | specifies the signal flags of the thread that shall be cleared. |
Clear the signal flags of an active thread.
Code Example
int32_t osSignalSet | ( | osThreadId | thread_id, |
int32_t | signals | ||
) |
[in] | thread_id | thread ID obtained by osThreadCreate or osThreadGetId. |
[in] | signals | specifies the signal flags of the thread that should be set. |
Set the signal flags of an active thread. This function may be used also within interrupt service routines.
Code Example
osEvent osSignalWait | ( | int32_t | signals, |
uint32_t | millisec | ||
) |
[in] | signals | wait until all specified signal flags set or 0 for any single signal flag. |
[in] | millisec | timeout value or 0 in case of no time-out. |
Suspend the execution of the current RUNNING thread until all specified signal flags with the parameter signals are set. When the parameter signals is 0 the current RUNNING thread is suspended until any signal is set. When these signal flags are already set, the function returns instantly. Otherwise the thread is put into the state WAITING. Signal flags that are reported as event are automatically cleared.
The argument millisec specifies how long the system waits for the specified signal flags. While the system waits the tread calling this function is put into the state WAITING. The timeout value can have the following values:
Code Example