|
template<typename F >
requires (StackSize > 0) && ThreadEntry<F> |
| | Thread (F entry, void *ctx, ove_prio_t prio, const char *name) |
| | Constructs and starts the thread.
|
| |
|
| ~Thread () |
| | Destroys the thread wrapper, terminating and releasing the kernel thread.
|
| |
|
| Thread (const Thread &)=delete |
| |
|
Thread & | operator= (const Thread &)=delete |
| |
| | Thread (Thread &&other) noexcept |
| | Move constructor — transfers ownership of the kernel handle.
|
| |
| Thread & | operator= (Thread &&other) noexcept |
| | Move-assignment operator — transfers ownership of the kernel handle.
|
| |
| void | set_priority (ove_prio_t prio) |
| | Changes the priority of the thread at runtime.
|
| |
| void | suspend () |
| | Suspends execution of the thread.
|
| |
|
void | resume () |
| | Resumes a previously suspended thread.
|
| |
| ove_thread_state_t | get_state () const |
| | Returns the current execution state of the thread.
|
| |
| size_t | get_stack_usage () const |
| | Returns the number of bytes used by the thread's stack so far.
|
| |
| int | get_runtime_stats (struct ove_thread_stats *stats) const |
| | Retrieves runtime statistics for the thread.
|
| |
| bool | valid () const |
| | Returns true if the underlying kernel handle is non-null.
|
| |
| ove_thread_t | handle () const |
| | Returns the raw oveRTOS thread handle.
|
| |
template<size_t StackSize = 0>
class ove::Thread< StackSize >
RAII wrapper around an oveRTOS thread (task).
Creates and starts a thread on construction. The thread is destroyed and the underlying kernel resource is released on destruction.
In zero-heap mode (CONFIG_OVE_ZERO_HEAP) the stack is stored as a member array, so StackSize must be greater than zero and move operations are disabled. On heap-enabled builds a non-zero StackSize is still required because it is passed to the kernel at construction time.
- Template Parameters
-
| StackSize | Stack size in bytes for the thread (must be > 0). |
- Note
- Not copyable. Move-only when heap allocation is enabled.
template<size_t StackSize = 0>
template<typename F >
requires (StackSize > 0) && ThreadEntry<F>
| ove::Thread< StackSize >::Thread |
( |
F |
entry, |
|
|
void * |
ctx, |
|
|
ove_prio_t |
prio, |
|
|
const char * |
name |
|
) |
| |
|
inline |
Constructs and starts the thread.
Only participates in overload resolution when StackSize > 0 and the entry function satisfies ThreadEntry.
- Template Parameters
-
| F | Entry function type satisfying ThreadEntry. |
- Parameters
-
| [in] | entry | Function pointer (or compatible callable) to use as the thread entry point, with signature void fn(void*). |
| [in] | ctx | Opaque pointer passed as the argument to entry. |
| [in] | prio | Thread priority as an ove_prio_t value. |
| [in] | name | Human-readable name for the thread (for debugging). |
Asserts at startup if thread creation fails.