CMSIS-RTOS2: Thread Functions

| CMSIS-RTOS2 Version 2.1.1 Real-Time Operating System: API and RTX Reference Implementation

- Main Page
- Usage and Description
- Reference

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Thread Functions
Event functions

Events generated by thread functions. More...

## Functions
void | EvrRtxThreadError (osThreadId_t thread_id, int32_t status)
| Event on thread error (Error) More...
void | EvrRtxThreadNew (osThreadFunc_t func, void *argument, const osThreadAttr_t *attr)
| Event on thread create and intialize (API) More...
void | EvrRtxThreadCreated (osThreadId_t thread_id)
| Event on successful thread create (Op) More...
void | EvrRtxThreadGetName (osThreadId_t thread_id, const char *name)
| Event on thread name retrieve (API) More...
void | EvrRtxThreadGetId (osThreadId_t thread_id)
| Event on current running thread ID retrieve (API) More...
void | EvrRtxThreadGetState (osThreadId_t thread_id, osThreadState_t state)
| Event on thread state retrieve (API) More...
void | EvrRtxThreadGetStackSize (osThreadId_t thread_id, uint32_t stack_size)
| Event on thread stack size retrieve (API) More...
void | EvrRtxThreadGetStackSpace (osThreadId_t thread_id, uint32_t stack_space)
| Event on available stack space retrieve (API) More...
void | EvrRtxThreadSetPriority (osThreadId_t thread_id, osPriority_t priority)
| Event on thread priority set (API) More...
void | EvrRtxThreadGetPriority (osThreadId_t thread_id, osPriority_t priority)
| Event on thread priority retrieve (API) More...
void | EvrRtxThreadYield (void)
| Event on thread yield (API) More...
void | EvrRtxThreadSuspend (osThreadId_t thread_id)
| Event on thread suspend (API) More...
void | EvrRtxThreadSuspended (osThreadId_t thread_id)
| Event on successful thread suspend (Op) More...
void | EvrRtxThreadResume (osThreadId_t thread_id)
| Event on thread resume (API) More...
void | EvrRtxThreadResumed (osThreadId_t thread_id)
| Event on successful thread resume (Op) More...
void | EvrRtxThreadDetach (osThreadId_t thread_id)
| Event on thread detach (API) More...
void | EvrRtxThreadDetached (osThreadId_t thread_id)
| Event on successful thread detach (Op) More...
void | EvrRtxThreadJoin (osThreadId_t thread_id)
| Event on thread join (API) More...
void | EvrRtxThreadJoinPending (osThreadId_t thread_id)
| Event on pending thread join (Op) More...
void | EvrRtxThreadJoined (osThreadId_t thread_id)
| Event on successful thread join (Op) More...
void | EvrRtxThreadBlocked (osThreadId_t thread_id, uint32_t timeout)
| Event on thread execution block (Op) More...
void | EvrRtxThreadUnblocked (osThreadId_t thread_id, uint32_t ret_val)
| Event on blocked thread release (Op) More...
void | EvrRtxThreadSwitch (osThreadId_t thread_id)
| Event on current running thread switch (Op) More...
void | EvrRtxThreadExit (void)
| Event on thread exit (API) More...
void | EvrRtxThreadTerminate (osThreadId_t thread_id)
| Event on thread terminate (API) More...
void | EvrRtxThreadDestroyed (osThreadId_t thread_id)
| Event on successful thread terminate (Op) More...
void | EvrRtxThreadGetCount (uint32_t count)
| Event on active thread count retrieve (API) More...
void | EvrRtxThreadEnumerate (osThreadId_t *thread_array, uint32_t array_items, uint32_t count)
| Event on active threads enumerate (API) More...
void | EvrRtxThreadFlagsWaitTimeout (void)
| Event on wait timeout for thread flags (Op) More...
void | EvrRtxThreadDelay (uint32_t ticks)
| Event on wait for timeout (API) More...
void | EvrRtxThreadDelayUntil (uint32_t ticks)
| Event on wait until specified time (API) More...
void | EvrRtxThreadDelayCompleted (void)
| Event on completed wait (Op) More...

## Description

## Function Documentation

void EvrRtxThreadError | ( | osThreadId_t | thread_id,
|  | int32_t | status
| ) |  |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId or NULL when ID is unknown.
  [in] | status | extended execution status.

The event ThreadError is generated when Thread Flags and Thread Management routines complete their execution due to an error.

The status parameter indicates the execution status and can be one of the osStatus_t codes or one of the extended execution status codes which are summarized in the table below.

Extended Status Code | Description
--- | ---
osRtxErrorKernelNotReady | Kernel scheduler is not in Ready state.
osRtxErrorKernelNotRunning | Kernel scheduler is not executing - there is no running thread.
osRtxErrorInvalidControlBlock | Object control block with invalid alignment or size was specified.
osRtxErrorInvalidDataMemory | Object data memory with invalid alignment or size was specified.
osRtxErrorInvalidThreadStack | Thread stack memory with invalid alignment or size was specified.
osRtxErrorInvalidPriority | Invalid thread priority was specified.
osRtxErrorThreadNotJoinable | Specified thread is not joinable.
osRtxErrorMutexNotOwned | Specified mutex is not owned by the current running thread.
osRtxErrorMutexNotLocked | Specified mutex is not locked.
osRtxErrorMutexLockLimit | Maximum number of recursive mutex locks reached.
osRtxErrorSemaphoreCountLimit | Semaphore count limit reached.
osRtxErrorTZ_InitContext_S | Secure context memory system initialization failed.
osRtxErrorTZ_AllocContext_S | Secure context memory allocation failed.
osRtxErrorTZ_FreeContext_S | Secure context memory deallocation failed.
osRtxErrorTZ_LoadContext_S | Secure context load failed.
osRtxErrorTZ_SaveContext_S | Secure context save failed.

Value in the Event Recorder shows:

- thread_id : thread ID.
- status : execution status code.

void EvrRtxThreadNew | ( | osThreadFunc_t | func,
|  | void * | argument,
|  | const osThreadAttr_t * | attr
| ) |  |

Parameters

  [in] | func | thread function.
  [in] | argument | pointer that is passed to the thread function as start argument.
  [in] | attr | thread attributes.

The event ThreadNew is generated when the function osThreadNew is called.

Value in the Event Recorder shows:

- func : memory address of thread function.
- argument : memory address of thread function start argument.
- attr : memory address of Thread attributes or 0 when they are not specified.

In case when thread attributes are provided in the API call they are also detailed in the Event Recorder.

void EvrRtxThreadCreated | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadCreated is generated when the function osThreadNew successfully creates a thread object.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadGetName | ( | osThreadId_t | thread_id,
|  | const char * | name
| ) |  |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.
  [in] | name | pointer to thread object name

The event ThreadGetName is generated when the function osThreadGetName is called and its execution result is known.

Value in the Event Recorder shows:

- thread_id : thread ID.
- name : retrieved memory address of name string (0 in case of a failure).

void EvrRtxThreadGetId | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadGetId is generated when the function osThreadGetId is called and its execution result is known.

Value in the Event Recorder shows:

- thread_id : retrieved thread (0 in case of a failure).

void EvrRtxThreadGetState | ( | osThreadId_t | thread_id,
|  | osThreadState_t | state
| ) |  |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.
  [in] | state | current thread state of the specified thread.

The event ThreadGetState is generated when the function osThreadGetState is called and its execution result is known.

Value in the Event Recorder shows:

- thread_id : thread ID.
- state : retrieved current thread state.

void EvrRtxThreadGetStackSize | ( | osThreadId_t | thread_id,
|  | uint32_t | stack_size
| ) |  |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.
  [in] | stack_size | stack size in bytes.

The event ThreadGetStackSize is generated when the function osThreadGetStackSize is called and its execution result is known.

Value in the Event Recorder shows:

- thread_id : thread ID.
- stack_size : retrieved remaining stack space in bytes (0 in case of a failure).

void EvrRtxThreadGetStackSpace | ( | osThreadId_t | thread_id,
|  | uint32_t | stack_space
| ) |  |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.
  [in] | stack_space | remaining stack space in bytes.

The event ThreadGetStackSpace is generated when the function osThreadGetStackSpace is called and its execution result is known.

Value in the Event Recorder shows:

- thread_id : thread ID.
- stack_space : retrieved remaining stack space in bytes (0 in case of a failure).

void EvrRtxThreadSetPriority | ( | osThreadId_t | thread_id,
|  | osPriority_t | priority
| ) |  |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.
  [in] | priority | new priority value for the thread function.

The event ThreadSetPriority is generated when the function osThreadSetPriority is called.

Value in the Event Recorder shows:

- thread_id : thread ID.
- priority : new priority value for the thread function.

void EvrRtxThreadGetPriority | ( | osThreadId_t | thread_id,
|  | osPriority_t | priority
| ) |  |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.
  [in] | priority | current priority value of the specified thread.

The event ThreadGetPriority is generated when the function osThreadGetPriority is called and its execution result is known.

Value in the Event Recorder shows:

- thread_id : thread ID.
- priority : current priority value of the specified thread.

void EvrRtxThreadYield | ( | void |  | ) |

The event ThreadYield is generated when the function osThreadYield is called.

void EvrRtxThreadSuspend | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadSuspend is generated when the function osThreadSuspend is called.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadSuspended | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadSuspended is generated when the function osThreadSuspend successfully suspends the specified thread.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadResume | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadResume is generated when the function osThreadResume is called.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadResumed | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadResumed is generated when the function osThreadResume successfully resumes the specified thread.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadDetach | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadDetach is generated when the function osThreadDetach is called.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadDetached | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadDetached is generated when the function osThreadDetach successfully detaches the specified thread.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadJoin | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadJoin is generated when the function osThreadJoin is called.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadJoinPending | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadJoinPending is generated when the function osThreadJoin suspends current running thread until the specified thread terminates.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadJoined | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadJoined is generated when the function osThreadJoin successfully joins the specified thread.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadBlocked | ( | osThreadId_t | thread_id,
|  | uint32_t | timeout
| ) |  |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.
  [in] | timeout | Timeout Value or 0 in case of no time-out.

The event ThreadBlocked is generated when the current running thread operation is blocked.

Value in the Event Recorder shows:

- thread_id : thread ID.
- timeout : Timeout Value.

void EvrRtxThreadUnblocked | ( | osThreadId_t | thread_id,
|  | uint32_t | ret_val
| ) |  |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.
  [in] | ret_val | extended execution status of the thread.

The event ThreadUnblocked is generated when the delayed thread operation is unblocked.

Value in the Event Recorder shows:

- thread_id : thread ID.
- ret_val :

void EvrRtxThreadSwitch | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadSwitch is generated when the running thread switch is executed.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadExit | ( | void |  | ) |

The event ThreadExit is generated when the function osThreadExit is called.

void EvrRtxThreadTerminate | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadTerminate is generated when the function osThreadTerminate is called.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadDestroyed | ( | osThreadId_t | thread_id | ) |

Parameters

  [in] | thread_id | thread ID obtained by osThreadNew or osThreadGetId.

The event ThreadDestroyed is generated when the functions osThreadExit and osThreadTerminate successfully terminate the thread.

Value in the Event Recorder shows:

- thread_id : thread ID.

void EvrRtxThreadGetCount | ( | uint32_t | count | ) |

Parameters

  [in] | count | number of active threads.

The event ThreadGetCount is generated when the function osThreadGetCount is called and its execution result is known.

Value in the Event Recorder shows:

- count : retrieved number of active threads (0 in case of a failure).

void EvrRtxThreadEnumerate | ( | osThreadId_t * | thread_array,
|  | uint32_t | array_items,
|  | uint32_t | count
| ) |  |

Parameters

  [in] | thread_array | pointer to array for retrieving thread IDs.
  [in] | array_items | maximum number of items in array for retrieving thread IDs.
  [in] | count | number of enumerated threads.

The event ThreadEnumerate is generated when the function osThreadEnumerate is called and its execution result is known.

Value in the Event Recorder shows:

- thread_array : memory address of array for retrieving thread IDs.
- array_items : maximum number of items in thread_array.
- count : number of enumerated threads (0 in case of a failure).

void EvrRtxThreadFlagsWaitTimeout | ( | void |  | ) |

The event ThreadFlagsWaitTimeout is generated when wait for thread flags to become signaled is aborted due to expired wait timeout.

void EvrRtxThreadDelay | ( | uint32_t | ticks | ) |

Parameters

  [in] | ticks | time ticks value

The event ThreadDelay is generated when the function osDelay is called.

Value in the Event Recorder shows:

- ticks : time ticks value.

void EvrRtxThreadDelayUntil | ( | uint32_t | ticks | ) |

Parameters

  [in] | ticks | absolute time in ticks

The event ThreadDelayUntil is generated when the function osDelayUntil is called.

Value in the Event Recorder shows:

- ticks : absolute delay time in ticks.

void EvrRtxThreadDelayCompleted | ( | void |  | ) |

The event ThreadDelayCompleted is generated when thread delay expires.