pw::thread::Options for ThreadX.
Example usage:
Public Member Functions | |
| constexpr | Options (const Options &)=default |
| constexpr | Options (Options &&)=default |
| constexpr Options & | set_name (const char *name) |
| constexpr Options & | set_priority (UINT priority) |
| constexpr Options & | set_preemption_threshold (UINT preemption_threshold) |
| constexpr Options & | set_time_slice_interval (ULONG time_slice_interval) |
| constexpr Options & | set_context (Context &context) |
Sets the pre-allocated context (all memory needed to run a thread). Note that this is required for this thread creation backend. The Context can either be constructed with an externally provided pw::span<ULONG> stack or the templated form of ContextWithStack<kStackSizeWords> can be used.
| [in,out] | context | Pre-allocated Context for the thread. |
Options instance for chaining.
|
inlineconstexpr |
Sets the name for the ThreadX thread. Note that this will be deep-copied into the context and may be truncated based on PW_THREAD_THREADX_CONFIG_MAX_THREAD_NAME_LEN.
| [in] | name | Null-terminated thread name string. |
Options instance for chaining.
|
inlineconstexpr |
Optionally sets the initial preemption threshold for the ThreadX thread.
Only priorities higher than this level (i.e. lower number) are allowed to preempt this thread. In other words, this allows the thread to specify the priority ceiling for disabling preemption. Threads that have a higher priority than the ceiling are still allowed to preempt while those with less than or equal to the ceiling are not allowed to preempt.
Not setting the preemption threshold or explicitly specifying a value equal to the priority disables the preemption threshold.
Time slicing is disabled while the preemption threshold is enabled (i.e. not equal to the priority), even if a time slice interval was specified.
The preemption threshold can be adjusted at run time; this only sets the initial threshold.
preemption_threshold <= priority.| [in] | preemption_threshold | Initial ThreadX preemption threshold. |
Options instance for chaining.
|
inlineconstexpr |
Sets the priority for the ThreadX thread from 0 through PW_THREAD_THREADX_CONFIG_MIN_PRIORITY (typically 31), where a value of 0 represents the highest priority. See ThreadX tx_thread_create for more detail.
priority <= PW_THREAD_THREADX_CONFIG_MIN_PRIORITY.| [in] | priority | ThreadX priority level. |
Options instance for chaining.
|
inlineconstexpr |
Sets the number of ticks this thread is allowed to run before other ready threads of the same priority are given a chance to run.
Time slicing is disabled while the preemption threshold is enabled (i.e. not equal to the priority), even if a time slice interval was specified.
A value of TX_NO_TIME_SLICE (a value of 0) disables time-slicing of this thread.
Using time slicing results in a slight amount of system overhead; threads with a unique priority should consider TX_NO_TIME_SLICE.
| [in] | time_slice_interval | Time slice interval in ticks, or TX_NO_TIME_SLICE (0) to disable time-slicing. |
Options instance for chaining.