26 #include "rtos/mbed_rtos_types.h" 27 #include "rtos/mbed_rtos1_types.h" 28 #include "rtos/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" 35 #if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) || defined(UNITTEST) 100 Thread(osPriority priority = osPriorityNormal,
102 unsigned char *stack_mem =
nullptr,
const char *name =
nullptr)
104 constructor(priority,
stack_size, stack_mem, name);
120 Thread(uint32_t tz_module, osPriority priority = osPriorityNormal,
122 unsigned char *stack_mem =
nullptr,
const char *name =
nullptr)
124 constructor(tz_module, priority,
stack_size, stack_mem, name);
148 "Thread-spawning constructors hide errors. " 149 "Replaced by thread.start(task).")
151 osPriority priority = osPriorityNormal,
153 unsigned char *stack_mem =
nullptr)
155 constructor(task, priority,
stack_size, stack_mem);
178 template <
typename T>
180 "Thread-spawning constructors hide errors. " 181 "Replaced by thread.start(callback(task, argument)).")
183 osPriority priority = osPriorityNormal,
185 unsigned char *stack_mem =
nullptr)
211 template <
typename T>
213 "Thread-spawning constructors hide errors. " 214 "Replaced by thread.start(callback(task, argument)).")
216 osPriority priority = osPriorityNormal,
218 unsigned char *stack_mem =
nullptr)
246 "Thread-spawning constructors hide errors. " 247 "Replaced by thread.start(callback(task, argument)).")
248 Thread(
void (*task)(
void const *argument),
void *argument =
nullptr,
249 osPriority priority = osPriorityNormal,
251 unsigned char *stack_mem =
nullptr)
275 template <
typename T,
typename M>
277 "The start function does not support cv-qualifiers. " 278 "Replaced by thread.start(callback(obj, method)).")
330 "Other signal_xxx methods have been deprecated in favour of ThisThread::flags functions. " 331 "To match this naming scheme, derived from CMSIS-RTOS2, Thread::flags_set is now provided.")
404 osThreadId_t
get_id()
const;
414 "Static methods only affecting current thread cause confusion. " 415 "Replaced by ThisThread::flags_clear.")
428 "Static methods only affecting current thread cause confusion. "
429 "Replaced by ThisThread::flags_wait_all, ThisThread::flags_wait_all_for, ThisThread::flags_wait_any and ThisThread:wait_any_for.")
443 "Static methods only affecting current thread cause confusion. "
444 "Replaced by ThisThread::sleep_for.")
445 static osStatus
wait(uint32_t millisec);
463 "Static methods only affecting current thread cause confusion. "
464 "Replaced by ThisThread::sleep_until.")
465 static osStatus
wait_until(uint64_t millisec);
474 "Static methods only affecting current thread cause confusion. "
475 "Replaced by ThisThread::
yield.")
476 static osStatus
yield();
486 "Static methods only affecting current thread cause confusion. "
488 static osThreadId
gettid();
497 "Static methods affecting system cause confusion. "
508 "Static methods affecting system cause confusion. "
509 "Replaced by Kernel::attach_thread_terminate_hook.")
521 void constructor(osPriority priority = osPriorityNormal,
523 unsigned char *stack_mem =
nullptr,
524 const
char *name =
nullptr);
525 void constructor(
mbed::Callback<
void()> task,
526 osPriority priority = osPriorityNormal,
528 unsigned char *stack_mem =
nullptr,
529 const
char *name =
nullptr);
530 void constructor(uint32_t tz_module,
531 osPriority priority = osPriorityNormal,
533 unsigned char *stack_mem =
nullptr,
534 const
char *name =
nullptr);
535 static
void _thunk(
void *thread_ptr);
537 mbed::Callback<
void()> _task;
542 mutable
Mutex _mutex;
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.
Attributes structure for 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.
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.
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.
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.
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.
Waiting for message to arrive.
State
State of the Thread.
Waiting for a thread flag to be set.
Event structure contains detailed information about an event.
osStatus join()
Wait for thread to terminate.
Waiting for a event flag to be set.
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.
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.