oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions
thread.h File Reference
#include "ove/types.h"
#include <stdbool.h>
#include "ove/storage.h"
Include dependency graph for thread.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ove_thread_stats
 Per-thread runtime statistics snapshot. More...
 
struct  ove_mem_stats
 System heap statistics. More...
 
struct  ove_thread_state_times
 Cumulative time per thread state (microseconds). More...
 
struct  ove_thread_info
 Snapshot of a single thread's info. More...
 

Typedefs

typedef void(* ove_thread_fn) (void *arg)
 Thread entry-point function prototype.
 

Enumerations

enum  ove_thread_state_t {
  OVE_THREAD_STATE_RUNNING = 0 , OVE_THREAD_STATE_READY , OVE_THREAD_STATE_BLOCKED , OVE_THREAD_STATE_SUSPENDED ,
  OVE_THREAD_STATE_TERMINATED , OVE_THREAD_STATE_UNKNOWN
}
 Thread execution state as reported by the active backend. More...
 
enum  ove_prio_t {
  OVE_PRIO_IDLE = 0 , OVE_PRIO_LOW = 1 , OVE_PRIO_BELOW_NORMAL = 2 , OVE_PRIO_NORMAL = 3 ,
  OVE_PRIO_ABOVE_NORMAL = 4 , OVE_PRIO_HIGH = 5 , OVE_PRIO_REALTIME = 6 , OVE_PRIO_CRITICAL = 7
}
 Portable thread-priority levels. More...
 

Functions

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.
 
int ove_thread_deinit (ove_thread_t handle)
 Terminate and release a thread created with ove_thread_init().
 
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.
 
int ove_thread_destroy (ove_thread_t handle)
 Stop and free a thread created with ove_thread_create().
 
ove_thread_t ove_thread_get_self (void)
 Return the handle of the currently executing thread.
 
void ove_thread_set_priority (ove_thread_t handle, ove_prio_t prio)
 Change the scheduling priority of a thread.
 
void ove_thread_sleep_ms (uint32_t ms)
 Block the calling thread for at least ms milliseconds.
 
void ove_thread_yield (void)
 Voluntarily yield the CPU to another ready thread of equal or higher priority.
 
void ove_thread_start_scheduler (void)
 Start the RTOS scheduler.
 
void ove_thread_suspend (ove_thread_t handle)
 Suspend a thread, preventing it from being scheduled.
 
void ove_thread_resume (ove_thread_t handle)
 Resume a previously suspended thread.
 
void ove_thread_request_stop (ove_thread_t handle)
 Cooperatively request that a thread stop running.
 
bool ove_thread_should_stop (ove_thread_t handle)
 Check whether the calling (or specified) thread has been asked to stop.
 
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.
 
ove_thread_state_t ove_thread_get_state (ove_thread_t handle)
 Query the current execution state of a thread.
 
int ove_thread_get_runtime_stats (ove_thread_t handle, struct ove_thread_stats *stats)
 Retrieve runtime statistics for a thread.
 
int ove_sys_get_mem_stats (struct ove_mem_stats *stats)
 Query system heap statistics.
 
int ove_thread_list (struct ove_thread_info *out, size_t max_count, size_t *actual_count)
 List all threads in the system.