26 #include "cmsis_os2.h" 27 #include "mbed_rtos1_types.h" 28 #include "mbed_rtos_storage.h" 29 #include "platform/Callback.h" 30 #include "platform/mbed_toolchain.h" 31 #include "platform/NonCopyable.h" 32 #include "rtos/Semaphore.h" 33 #include "rtos/Mutex.h" 97 Thread(osPriority priority = osPriorityNormal,
99 unsigned char *stack_mem = NULL,
const char *name = NULL)
101 constructor(priority,
stack_size, stack_mem, name);
117 Thread(uint32_t tz_module, osPriority priority = osPriorityNormal,
119 unsigned char *stack_mem = NULL,
const char *name = NULL)
121 constructor(tz_module, priority,
stack_size, stack_mem, name);
145 "Thread-spawning constructors hide errors. " 146 "Replaced by thread.start(task).")
148 osPriority priority = osPriorityNormal,
150 unsigned char *stack_mem = NULL)
152 constructor(task, priority,
stack_size, stack_mem);
175 template <
typename T>
177 "Thread-spawning constructors hide errors. " 178 "Replaced by thread.start(callback(task, argument)).")
180 osPriority priority = osPriorityNormal,
182 unsigned char *stack_mem = NULL)
208 template <
typename T>
210 "Thread-spawning constructors hide errors. " 211 "Replaced by thread.start(callback(task, argument)).")
213 osPriority priority = osPriorityNormal,
215 unsigned char *stack_mem = NULL)
243 "Thread-spawning constructors hide errors. " 244 "Replaced by thread.start(callback(task, argument)).")
245 Thread(
void (*task)(
void const *argument),
void *argument = NULL,
246 osPriority priority = osPriorityNormal,
248 unsigned char *stack_mem = NULL)
272 template <
typename T,
typename M>
274 "The start function does not support cv-qualifiers. " 275 "Replaced by thread.start(callback(obj, method)).")
327 "Other signal_xxx methods have been deprecated in favour of ThisThread::flags functions. " 328 "To match this naming scheme, derived from CMSIS-RTOS2, Thread::flags_set is now provided.")
401 osThreadId_t
get_id()
const;
411 "Static methods only affecting current thread cause confusion. " 412 "Replaced by ThisThread::flags_clear.")
425 "Static methods only affecting current thread cause confusion. "
426 "Replaced by ThisThread::flags_wait_all, ThisThread::flags_wait_all_for, ThisThread::flags_wait_any and ThisThread:wait_any_for.")
427 static osEvent
signal_wait(int32_t signals, uint32_t millisec = osWaitForever);
440 "Static methods only affecting current thread cause confusion. "
441 "Replaced by ThisThread::sleep_for.")
442 static osStatus
wait(uint32_t millisec);
460 "Static methods only affecting current thread cause confusion. "
461 "Replaced by ThisThread::sleep_until.")
462 static osStatus
wait_until(uint64_t millisec);
471 "Static methods only affecting current thread cause confusion. "
472 "Replaced by ThisThread::
yield.")
473 static osStatus
yield();
483 "Static methods only affecting current thread cause confusion. "
485 static osThreadId
gettid();
494 "Static methods affecting system cause confusion. "
505 "Static methods affecting system cause confusion. "
518 void constructor(osPriority priority = osPriorityNormal,
520 unsigned char *stack_mem = NULL,
521 const
char *name = NULL);
522 void constructor(
mbed::Callback<
void()> task,
523 osPriority priority = osPriorityNormal,
525 unsigned char *stack_mem = NULL,
526 const
char *name = NULL);
527 void constructor(uint32_t tz_module,
528 osPriority priority = osPriorityNormal,
530 unsigned char *stack_mem = NULL,
531 const
char *name = NULL);
532 static
void _thunk(
void *thread_ptr);
534 mbed::Callback<
void()> _task;
536 osThreadAttr_t _attr;
539 mutable
Mutex _mutex;
540 mbed_rtos_storage_thread_t _obj_mem;
The Thread class allow defining, creating, and controlling thread functions in the system...
uint32_t flags_set(uint32_t flags)
Set the specified Thread Flags for the thread.
Waiting for a memory pool.
int32_t signal_set(int32_t signals)
Set the specified Thread Flags for the thread.
The Semaphore class is used to manage and protect access to a set of shared resources.
osStatus terminate()
Terminate execution of a thread and remove it from Active Threads.
osStatus set_priority(osPriority priority)
Set priority of an active thread.
NOT USED (Mail is implemented as MemoryPool and Queue)
uint32_t free_stack() const
Get the currently unused stack memory for this Thread.
static osStatus yield()
Pass control to next thread that is in state READY.
static osEvent signal_wait(int32_t signals, uint32_t millisec=osWaitForever)
Wait for one or more Thread Flags to become signaled for the current RUNNING thread.
Thread(osPriority priority=osPriorityNormal, uint32_t stack_size=OS_STACK_SIZE, unsigned char *stack_mem=NULL, const char *name=NULL)
Allocate a new thread without starting execution.
Waiting for a mutex event to occur.
Prevents generation of copy constructor and copy assignment operator in derived classes.
static void attach_terminate_hook(void(*fptr)(osThreadId id))
Attach a function to be called when a task is killed.
Waiting for message to be send.
Waiting for message to arrive.
State
State of the Thread.
Waiting for a thread flag to be set.
osStatus join()
Wait for thread to terminate.
Waiting for a event flag to be set.
void attach_thread_terminate_hook(void(*fptr)(osThreadId_t id))
Attach a function to be called when a thread terminates.
Waiting for thread to join.
osPriority get_priority() const
Get priority of an active thread.
The Mutex class is used to synchronize the execution of threads.
uint32_t used_stack() const
Get the currently used stack memory for this Thread.
State get_state() const
State of this Thread.
static osStatus wait_until(uint64_t millisec)
Wait until a specified time in millisec The specified time is according to Kernel::get_ms_count().
Waiting for a delay to occur.
const char * get_name() const
Get thread name.
Waiting for a semaphore event to occur.
Thread(uint32_t tz_module, osPriority priority=osPriorityNormal, uint32_t stack_size=OS_STACK_SIZE, unsigned char *stack_mem=NULL, const char *name=NULL)
Allocate a new thread without starting execution.
static osStatus wait(uint32_t millisec)
Wait for a specified time period in milliseconds Being tick-based, the delay will be up to the specif...
osStatus start(mbed::Callback< void()> task)
Starts a thread executing the specified function.
static int32_t signal_clr(int32_t signals)
Clears the specified Thread Flags of the currently running thread.
static void attach_idle_hook(void(*fptr)(void))
Attach a function to be called by the RTOS idle task.
osThreadId_t get_id() const
Get thread id.
Callback class based on template specialization.
The task has been deleted or not started.
static osThreadId gettid()
Get the thread id of the current running thread.
uint32_t max_stack() const
Get the maximum stack memory usage to date for this Thread.
uint32_t stack_size() const
Get the total stack memory size for this Thread.