![]() |
SuperTinyKernel™ RTOS 1.08.x
Lightweight, high-performance, deterministic, bare-metal C++ RTOS for resource-constrained embedded systems. MIT Open Source License.
|
Classes | |
| struct | KeyEntry |
Typedefs | |
| using | ThreadCtrl = pthread_stk_ctrl_t |
Functions | |
| STK_BLOCKPOOL_STORAGE_DECL (s_PthreadStackStorage,(8U), kDefaultStackBytes) | |
| stk_blockpool_t * | EnsureStackPool () |
| void | ReleaseThreadResources (ThreadCtrl *ctrl) |
| void | WaitForTaskGone (stk_task_t *task) |
| void | ReaperEntry (void *arg) |
| void | EnsureReaper () |
| void | EnqueueReap (ThreadCtrl *ctrl) |
| ThreadCtrl * | DequeueReap () |
| void | MaybeReap (ThreadCtrl *ctrl) |
| ThreadCtrl * | AcquireThreadSlot () |
| void | PthreadTrampoline (void *arg) |
| stk_timeout_t | TimespecToRelativeTimeout (const struct timespec *abstime) |
| stk_mutex_t * | EnsureMutex (pthread_mutex_t *m) |
| stk_cv_t * | EnsureCond (pthread_cond_t *c) |
| stk_rwmutex_t * | EnsureRWLock (pthread_rwlock_t *rw) |
| stk_mutex_t * | EnsureOnceMutex (pthread_once_t *o) |
| void | RunKeyDestructors (ThreadCtrl *ctrl) |
Variables | |
| constexpr std::size_t | kDefaultStackBytes |
| ThreadCtrl | s_Threads [(8U)] |
| stk_kernel_t * | s_BoundKernel = nullptr |
| stk_blockpool_t * | s_StackPool = nullptr |
| ThreadCtrl * | s_ReapQueue [(8U)] |
| std::size_t | s_ReapHead = 0U |
| std::size_t | s_ReapCount = 0U |
| stk_sem_t * | s_ReapSem = nullptr |
| stk_sem_mem_t | s_ReapSemMem |
| stk_task_t * | s_ReaperTask = nullptr |
| stk_word_t | s_ReaperStack [(256U)] |
| KeyEntry | s_Keys [(8U)] |
| using anonymous_namespace{stk_c_pthread.cpp}::ThreadCtrl = pthread_stk_ctrl_t |
Definition at line 58 of file stk_c_pthread.cpp.
| ThreadCtrl * anonymous_namespace{stk_c_pthread.cpp}::AcquireThreadSlot | ( | ) |
Definition at line 209 of file stk_c_pthread.cpp.
References s_Threads, STK_C_PTHREAD_MAX_THREADS, stk_critical_section_enter(), and stk_critical_section_exit().
Referenced by pthread_create().
| ThreadCtrl * anonymous_namespace{stk_c_pthread.cpp}::DequeueReap | ( | ) |
Definition at line 151 of file stk_c_pthread.cpp.
References s_ReapCount, s_ReapHead, s_ReapQueue, STK_C_PTHREAD_MAX_THREADS, stk_critical_section_enter(), and stk_critical_section_exit().
Referenced by ReaperEntry().
| void anonymous_namespace{stk_c_pthread.cpp}::EnqueueReap | ( | ThreadCtrl * | ctrl | ) |
Definition at line 138 of file stk_c_pthread.cpp.
References s_ReapCount, s_ReapHead, s_ReapQueue, STK_C_ASSERT, STK_C_PTHREAD_MAX_THREADS, stk_critical_section_enter(), and stk_critical_section_exit().
Referenced by MaybeReap().
| stk_cv_t * anonymous_namespace{stk_c_pthread.cpp}::EnsureCond | ( | pthread_cond_t * | c | ) |
Definition at line 352 of file stk_c_pthread.cpp.
References pthread_cond_t::__handle, pthread_cond_t::__mem, stk_critical_section_enter(), stk_critical_section_exit(), and stk_cv_create().
Referenced by pthread_cond_broadcast(), pthread_cond_signal(), pthread_cond_timedwait(), and pthread_cond_wait().
| stk_mutex_t * anonymous_namespace{stk_c_pthread.cpp}::EnsureMutex | ( | pthread_mutex_t * | m | ) |
Definition at line 337 of file stk_c_pthread.cpp.
References pthread_mutex_t::__handle, pthread_mutex_t::__mem, stk_critical_section_enter(), stk_critical_section_exit(), and stk_mutex_create().
Referenced by pthread_mutex_lock(), pthread_mutex_timedlock(), and pthread_mutex_trylock().
| stk_mutex_t * anonymous_namespace{stk_c_pthread.cpp}::EnsureOnceMutex | ( | pthread_once_t * | o | ) |
Definition at line 382 of file stk_c_pthread.cpp.
References pthread_once_t::__handle, pthread_once_t::__mem, stk_critical_section_enter(), stk_critical_section_exit(), and stk_mutex_create().
Referenced by pthread_once().
| void anonymous_namespace{stk_c_pthread.cpp}::EnsureReaper | ( | ) |
Definition at line 112 of file stk_c_pthread.cpp.
References ReaperEntry(), s_BoundKernel, s_ReaperStack, s_ReaperTask, s_ReapSem, s_ReapSemMem, STK_C_ASSERT, STK_C_PTHREAD_REAPER_STACK_WORDS, stk_critical_section_enter(), stk_critical_section_exit(), stk_kernel_add_task(), stk_sem_create(), stk_task_create_user(), and stk_task_set_name().
Referenced by MaybeReap(), and pthread_create().
| stk_rwmutex_t * anonymous_namespace{stk_c_pthread.cpp}::EnsureRWLock | ( | pthread_rwlock_t * | rw | ) |
Definition at line 367 of file stk_c_pthread.cpp.
References pthread_rwlock_t::__handle, pthread_rwlock_t::__mem, stk_critical_section_enter(), stk_critical_section_exit(), and stk_rwmutex_create().
Referenced by pthread_rwlock_rdlock(), pthread_rwlock_timedrdlock(), pthread_rwlock_timedwrlock(), pthread_rwlock_tryrdlock(), pthread_rwlock_trywrlock(), and pthread_rwlock_wrlock().
| stk_blockpool_t * anonymous_namespace{stk_c_pthread.cpp}::EnsureStackPool | ( | ) |
Definition at line 76 of file stk_c_pthread.cpp.
References kDefaultStackBytes, s_StackPool, stk_blockpool_create_static(), STK_C_PTHREAD_MAX_THREADS, stk_critical_section_enter(), and stk_critical_section_exit().
Referenced by pthread_create().
| void anonymous_namespace{stk_c_pthread.cpp}::MaybeReap | ( | ThreadCtrl * | ctrl | ) |
Definition at line 186 of file stk_c_pthread.cpp.
References pthread_stk_ctrl_t::detached, EnqueueReap(), EnsureReaper(), pthread_stk_ctrl_t::finished, pthread_stk_ctrl_t::reclaimed, s_ReapSem, stk_critical_section_enter(), stk_critical_section_exit(), and stk_sem_signal().
Referenced by pthread_detach(), pthread_exit(), and PthreadTrampoline().
| void anonymous_namespace{stk_c_pthread.cpp}::PthreadTrampoline | ( | void * | arg | ) |
Definition at line 288 of file stk_c_pthread.cpp.
References pthread_stk_ctrl_t::arg, pthread_stk_ctrl_t::done_event, pthread_stk_ctrl_t::finished, MaybeReap(), pthread_stk_ctrl_t::retval, RunKeyDestructors(), pthread_stk_ctrl_t::start_routine, stk_critical_section_enter(), stk_critical_section_exit(), stk_event_set(), and stk_tls_set().
Referenced by pthread_create().
| void anonymous_namespace{stk_c_pthread.cpp}::ReaperEntry | ( | void * | arg | ) |
Definition at line 167 of file stk_c_pthread.cpp.
References DequeueReap(), ReleaseThreadResources(), s_ReapSem, STK_C_ASSERT, stk_sem_wait(), STK_WAIT_INFINITE, pthread_stk_ctrl_t::task, and WaitForTaskGone().
Referenced by EnsureReaper().
| void anonymous_namespace{stk_c_pthread.cpp}::ReleaseThreadResources | ( | ThreadCtrl * | ctrl | ) |
Definition at line 259 of file stk_c_pthread.cpp.
References pthread_stk_ctrl_t::busy, pthread_stk_ctrl_t::done_event, free(), s_StackPool, pthread_stk_ctrl_t::stack, pthread_stk_ctrl_t::stack_from_pool, pthread_stk_ctrl_t::stack_owned, stk_blockpool_free(), stk_critical_section_enter(), stk_critical_section_exit(), and stk_event_destroy().
Referenced by pthread_join(), and ReaperEntry().
| void anonymous_namespace{stk_c_pthread.cpp}::RunKeyDestructors | ( | ThreadCtrl * | ctrl | ) |
Definition at line 415 of file stk_c_pthread.cpp.
References PTHREAD_DESTRUCTOR_ITERATIONS, s_Keys, STK_C_PTHREAD_KEYS_MAX, stk_critical_section_enter(), stk_critical_section_exit(), and pthread_stk_ctrl_t::tsd.
Referenced by pthread_exit(), and PthreadTrampoline().
| anonymous_namespace{stk_c_pthread.cpp}::STK_BLOCKPOOL_STORAGE_DECL | ( | s_PthreadStackStorage | , |
| (8U) | , | ||
| kDefaultStackBytes | ) |
References kDefaultStackBytes, and STK_C_PTHREAD_MAX_THREADS.
| stk_timeout_t anonymous_namespace{stk_c_pthread.cpp}::TimespecToRelativeTimeout | ( | const struct timespec * | abstime | ) |
Definition at line 318 of file stk_c_pthread.cpp.
References stk_ticks_from_ms_clamped_to_timeout(), and stk_time_now_ms().
Referenced by pthread_cond_timedwait(), pthread_mutex_timedlock(), pthread_rwlock_timedrdlock(), and pthread_rwlock_timedwrlock().
| void anonymous_namespace{stk_c_pthread.cpp}::WaitForTaskGone | ( | stk_task_t * | task | ) |
Definition at line 232 of file stk_c_pthread.cpp.
References s_BoundKernel, STK_C_KERNEL_MAX_TASKS, stk_kernel_enumerate_tasks(), and stk_sleep_ms().
Referenced by pthread_join(), and ReaperEntry().
|
constexpr |
Definition at line 60 of file stk_c_pthread.cpp.
Referenced by EnsureStackPool(), pthread_attr_getstacksize(), pthread_create(), and STK_BLOCKPOOL_STORAGE_DECL().
| stk_kernel_t* anonymous_namespace{stk_c_pthread.cpp}::s_BoundKernel = nullptr |
Definition at line 68 of file stk_c_pthread.cpp.
Referenced by EnsureReaper(), pthread_create(), pthread_exit(), stk_pthread_bind_kernel(), and WaitForTaskGone().
| KeyEntry anonymous_namespace{stk_c_pthread.cpp}::s_Keys[(8U)] |
Definition at line 406 of file stk_c_pthread.cpp.
Referenced by pthread_getspecific(), pthread_key_create(), pthread_key_delete(), pthread_setspecific(), and RunKeyDestructors().
| std::size_t anonymous_namespace{stk_c_pthread.cpp}::s_ReapCount = 0U |
Definition at line 101 of file stk_c_pthread.cpp.
Referenced by DequeueReap(), and EnqueueReap().
| stk_word_t anonymous_namespace{stk_c_pthread.cpp}::s_ReaperStack[(256U)] |
Definition at line 106 of file stk_c_pthread.cpp.
Referenced by EnsureReaper().
| stk_task_t* anonymous_namespace{stk_c_pthread.cpp}::s_ReaperTask = nullptr |
Definition at line 105 of file stk_c_pthread.cpp.
Referenced by EnsureReaper().
| std::size_t anonymous_namespace{stk_c_pthread.cpp}::s_ReapHead = 0U |
Definition at line 100 of file stk_c_pthread.cpp.
Referenced by DequeueReap(), and EnqueueReap().
| ThreadCtrl* anonymous_namespace{stk_c_pthread.cpp}::s_ReapQueue[(8U)] |
Definition at line 99 of file stk_c_pthread.cpp.
Referenced by DequeueReap(), and EnqueueReap().
| stk_sem_t* anonymous_namespace{stk_c_pthread.cpp}::s_ReapSem = nullptr |
Definition at line 103 of file stk_c_pthread.cpp.
Referenced by EnsureReaper(), MaybeReap(), and ReaperEntry().
| stk_sem_mem_t anonymous_namespace{stk_c_pthread.cpp}::s_ReapSemMem |
Definition at line 104 of file stk_c_pthread.cpp.
Referenced by EnsureReaper().
| stk_blockpool_t* anonymous_namespace{stk_c_pthread.cpp}::s_StackPool = nullptr |
Definition at line 74 of file stk_c_pthread.cpp.
Referenced by EnsureStackPool(), pthread_create(), and ReleaseThreadResources().
| ThreadCtrl anonymous_namespace{stk_c_pthread.cpp}::s_Threads[(8U)] |
Definition at line 63 of file stk_c_pthread.cpp.
Referenced by AcquireThreadSlot().