27#include "rtos/mbed_rtos_types.h"
28#include "rtos/internal/mbed_rtos1_types.h"
29#include "rtos/internal/mbed_rtos_storage.h"
30#include "platform/Callback.h"
31#include "platform/mbed_toolchain.h"
32#include "platform/NonCopyable.h"
33#include "rtos/Semaphore.h"
34#include "rtos/Mutex.h"
36#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY)
104 Thread(osPriority priority = osPriorityNormal,
106 unsigned char *stack_mem =
nullptr,
const char *name =
nullptr)
108 constructor(priority,
stack_size, stack_mem, name);
124 Thread(uint32_t tz_module, osPriority priority = osPriorityNormal,
126 unsigned char *stack_mem =
nullptr,
const char *name =
nullptr)
128 constructor(tz_module, priority,
stack_size, stack_mem, name);
260 void constructor(osPriority priority = osPriorityNormal,
262 unsigned char *stack_mem =
nullptr,
263 const char *name =
nullptr);
264 void constructor(uint32_t tz_module,
265 osPriority priority = osPriorityNormal,
267 unsigned char *stack_mem =
nullptr,
268 const char *name =
nullptr);
269 static void _thunk(
void *thread_ptr);
273 osThreadAttr_t _attr;
277 mutable Mutex _mutex;
278 mbed_rtos_storage_thread_t _obj_mem;
Callback class based on template specialization.
Prevents generation of copy constructor and copy assignment operator in derived classes.
The Mutex class is used to synchronize the execution of threads.
The Semaphore class is used to manage and protect access to a set of shared resources.
The Thread class allow defining, creating, and controlling thread functions in the system.
Thread(uint32_t tz_module, osPriority priority=osPriorityNormal, uint32_t stack_size=OS_STACK_SIZE, unsigned char *stack_mem=nullptr, const char *name=nullptr)
Allocate a new thread without starting execution.
virtual ~Thread()
Thread destructor.
uint32_t max_stack() const
Get the maximum stack memory usage to date for this Thread.
osStatus set_priority(osPriority priority)
Set priority of an active thread.
State
State of the Thread.
@ WaitingSemaphore
Waiting for a semaphore event to occur.
@ Deleted
The task has been deleted or not started.
@ WaitingMessagePut
Waiting for message to be send.
@ WaitingMailbox
NOT USED (Mail is implemented as MemoryPool and Queue)
@ WaitingThreadFlag
Waiting for a thread flag to be set.
@ WaitingMutex
Waiting for a mutex event to occur.
@ WaitingMessageGet
Waiting for message to arrive.
@ WaitingInterval
NOT USED.
@ WaitingMemoryPool
Waiting for a memory pool.
@ WaitingJoin
Waiting for thread to join.
@ WaitingEventFlag
Waiting for a event flag to be set.
@ WaitingDelay
Waiting for a delay to occur.
const char * get_name() const
Get thread name.
osStatus join()
Wait for thread to terminate.
osStatus start(mbed::Callback< void()> task)
Starts a thread executing the specified function.
osThreadId_t get_id() const
Get thread id.
State get_state() const
State of this Thread.
uint32_t flags_set(uint32_t flags)
Set the specified Thread Flags for the thread.
uint32_t stack_size() const
Get the total stack memory size for this Thread.
Thread(osPriority priority=osPriorityNormal, uint32_t stack_size=OS_STACK_SIZE, unsigned char *stack_mem=nullptr, const char *name=nullptr)
Allocate a new thread without starting execution.
osStatus terminate()
Terminate execution of a thread and remove it from Active Threads.
osPriority get_priority() const
Get priority of an active thread.
uint32_t used_stack() const
Get the currently used stack memory for this Thread.
uint32_t free_stack() const
Get the currently unused stack memory for this Thread.