Thread class

A wrapper around std::thread to simplify thread creation and destruction as well as manage events through interrupts with thread-safety.

Derived classes

class App

Constructors, destructors, conversion operators

Thread(string taskName = CONFIG_PTHREAD_TASK_NAME_DEFAULT, uint32_t stackSize = CONFIG_MAIN_TASK_STACK_SIZE, uint32_t priority = CONFIG_PTHREAD_TASK_PRIO_DEFAULT, int appCore = CONFIG_PTHREAD_TASK_CORE_DEFAULT, bool attach = false) explicit

Public functions

void start()

Protected functions

void init() virtual
void loop() virtual

Function documentation

Thread::Thread(string taskName = CONFIG_PTHREAD_TASK_NAME_DEFAULT, uint32_t stackSize = CONFIG_MAIN_TASK_STACK_SIZE, uint32_t priority = CONFIG_PTHREAD_TASK_PRIO_DEFAULT, int appCore = CONFIG_PTHREAD_TASK_CORE_DEFAULT, bool attach = false) explicit

Parameters
taskName the task name
stackSize the stack size
priority the priority
appCore the core to pin to
attach if this thread should attach to caller

Initializes a thread with the initialization function, task name, stack size, priority, and core to pin to.

void Thread::start()

Start the thread and wait until it has started and initialized.

void Thread::init() virtual protected

Performs any initialization once the new thread starts running.

void Thread::loop() virtual protected

Performs a task in a loop.