122#ifdef OVE_HEAP_THREAD
void ove_thread_sleep_ms(uint32_t ms)
Block the calling thread for at least ms milliseconds.
void ove_thread_resume(ove_thread_t handle)
Resume a previously suspended thread.
void ove_thread_set_priority(ove_thread_t handle, ove_prio_t prio)
Change the scheduling priority of a thread.
bool ove_thread_should_stop(ove_thread_t handle)
Check whether the calling (or specified) thread has been asked to stop.
void ove_thread_yield(void)
Voluntarily yield the CPU to another ready thread of equal or higher priority.
void ove_thread_request_stop(ove_thread_t handle)
Cooperatively request that a thread stop running.
int ove_sys_get_mem_stats(struct ove_mem_stats *stats)
Query system heap statistics.
int ove_thread_deinit(ove_thread_t handle)
Terminate and release a thread created with ove_thread_init().
void ove_thread_suspend(ove_thread_t handle)
Suspend a thread, preventing it from being scheduled.
int ove_thread_init(ove_thread_t *handle, ove_thread_storage_t *storage, const char *name, ove_thread_fn entry, void *arg, ove_prio_t priority, size_t stack_size, void *stack)
Initialise a thread using caller-supplied static storage and stack.
size_t ove_thread_get_stack_usage(ove_thread_t handle)
Query how many bytes of stack the thread has used at its high-water mark.
int ove_thread_create(ove_thread_t *handle, const char *name, ove_thread_fn entry, void *arg, ove_prio_t priority, size_t stack_size)
Allocate and start a heap-backed thread.
ove_thread_state_t ove_thread_get_state(ove_thread_t handle)
Query the current execution state of a thread.
ove_thread_t ove_thread_get_self(void)
Return the handle of the currently executing thread.
ove_thread_state_t
Thread execution state as reported by the active backend.
Definition thread.h:45
int ove_thread_destroy(ove_thread_t handle)
Stop and free a thread created with ove_thread_create().
void ove_thread_start_scheduler(void)
Start the RTOS scheduler.
ove_prio_t
Portable thread-priority levels.
Definition thread.h:68
int ove_thread_get_runtime_stats(ove_thread_t handle, struct ove_thread_stats *stats)
Retrieve runtime statistics for a thread.
void(* ove_thread_fn)(void *arg)
Thread entry-point function prototype.
Definition thread.h:40
int ove_thread_list(struct ove_thread_info *out, size_t max_count, size_t *actual_count)
List all threads in the system.
@ OVE_THREAD_STATE_UNKNOWN
State could not be determined.
Definition thread.h:51
@ OVE_THREAD_STATE_BLOCKED
Blocked on a synchronisation object or delay.
Definition thread.h:48
@ OVE_THREAD_STATE_RUNNING
Currently executing on the CPU.
Definition thread.h:46
@ OVE_THREAD_STATE_TERMINATED
Entry function has returned; not yet destroyed.
Definition thread.h:50
@ OVE_THREAD_STATE_READY
Ready to run, waiting for the CPU.
Definition thread.h:47
@ OVE_THREAD_STATE_SUSPENDED
Explicitly suspended via ove_thread_suspend().
Definition thread.h:49
@ OVE_PRIO_HIGH
High priority; prefer for time-sensitive tasks.
Definition thread.h:74
@ OVE_PRIO_NORMAL
Default application priority.
Definition thread.h:72
@ OVE_PRIO_BELOW_NORMAL
Below-normal priority.
Definition thread.h:71
@ OVE_PRIO_REALTIME
Real-time priority; use with care.
Definition thread.h:75
@ OVE_PRIO_ABOVE_NORMAL
Above-normal priority.
Definition thread.h:73
@ OVE_PRIO_LOW
Low priority background work.
Definition thread.h:70
@ OVE_PRIO_IDLE
Lowest priority; runs only when no other thread is ready.
Definition thread.h:69
@ OVE_PRIO_CRITICAL
Highest priority; reserved for critical system tasks.
Definition thread.h:76
struct ove_thread * ove_thread_t
Opaque handle for a thread object.
Definition types.h:208
System heap statistics.
Definition thread.h:302
size_t total
Definition thread.h:303
size_t used
Definition thread.h:305
size_t free
Definition thread.h:304
size_t peak_used
Definition thread.h:306
Snapshot of a single thread's info.
Definition thread.h:334
struct ove_thread_state_times state_times
Definition thread.h:341
const char * name
Definition thread.h:335
int priority
Definition thread.h:337
size_t stack_used
Definition thread.h:338
size_t stack_size
Definition thread.h:339
uint32_t cpu_percent_x100
Definition thread.h:340
ove_thread_state_t state
Definition thread.h:336
Cumulative time per thread state (microseconds).
Definition thread.h:324
uint64_t blocked_us
Definition thread.h:327
uint64_t suspended_us
Definition thread.h:328
uint64_t running_us
Definition thread.h:325
uint64_t ready_us
Definition thread.h:326
Per-thread runtime statistics snapshot.
Definition thread.h:57
uint32_t cpu_percent_x100
CPU utilisation in hundredths of a percent (e.g. 1250 = 12.50 %).
Definition thread.h:59
uint64_t runtime_us
Total CPU time consumed by this thread in microseconds.
Definition thread.h:58