29#include <mstdlib/base/m_defs.h>
30#include <mstdlib/base/m_types.h>
266#define M_THREAD_PRIORITY_MIN 1
269#define M_THREAD_PRIORITY_NORMAL 5
272#define M_THREAD_PRIORITY_MAX 9
426struct M_thread_mutex;
600struct M_thread_rwlock;
710typedef struct M_thread_spinlock {
717#define M_THREAD_SPINLOCK_STATIC_INITIALIZER { 0, 0, 0 }
773#define M_THREAD_ONCE_STATIC_INITIALIZER { M_FALSE, M_THREAD_SPINLOCK_STATIC_INITIALIZER }
void M_thread_cond_broadcast(M_thread_cond_t *cond)
M_bool M_thread_cond_timedwait_abs(M_thread_cond_t *cond, M_thread_mutex_t *mutex, const M_timeval_t *abstime)
M_bool M_thread_cond_timedwait(M_thread_cond_t *cond, M_thread_mutex_t *mutex, M_uint64 millisec)
M_bool M_thread_cond_wait(M_thread_cond_t *cond, M_thread_mutex_t *mutex)
M_thread_cond_t * M_thread_cond_create(M_uint32 attr)
struct M_thread_cond M_thread_cond_t
Definition: m_thread.h:502
void M_thread_cond_signal(M_thread_cond_t *cond)
void M_thread_cond_destroy(M_thread_cond_t *cond)
M_thread_condattr_t
Definition: m_thread.h:508
@ M_THREAD_CONDATTR_NONE
Definition: m_thread.h:509
M_uint8 M_thread_attr_get_priority(const M_thread_attr_t *attr)
M_threadid_t M_thread_create(const M_thread_attr_t *attr, void *(*func)(void *), void *arg)
M_bool M_thread_attr_set_processor(M_thread_attr_t *attr, int processor_id)
void M_thread_attr_destroy(M_thread_attr_t *attr)
void M_thread_attr_set_stack_size(M_thread_attr_t *attr, size_t val)
M_thread_attr_t * M_thread_attr_create(void)
int M_thread_attr_get_processor(const M_thread_attr_t *attr)
M_bool M_thread_attr_set_priority(M_thread_attr_t *attr, M_uint8 priority)
size_t M_thread_attr_get_stack_size(const M_thread_attr_t *attr)
struct M_thread_attr M_thread_attr_t
Definition: m_thread.h:228
M_threadid_t M_thread_self(void)
M_bool M_thread_join(M_threadid_t id, void **value_ptr)
M_bool M_thread_set_priority(M_threadid_t tid, M_uint8 priority)
void M_thread_sleep(M_uint64 usec)
M_bool M_thread_attr_get_create_joinable(const M_thread_attr_t *attr)
void M_thread_yield(M_bool force)
M_bool M_thread_set_processor(M_threadid_t tid, int processor_id)
void M_thread_attr_set_create_joinable(M_thread_attr_t *attr, M_bool val)
M_uintptr M_threadid_t
Definition: m_thread.h:223
M_bool M_thread_active_model(M_thread_model_t *model, const char **model_name)
M_thread_model_t
Definition: m_thread.h:108
size_t M_thread_num_cpu_cores(void)
void M_library_cleanup_register(void(*cleanup_cb)(void *arg), void *arg)
M_bool M_thread_init(M_thread_model_t model)
void M_thread_destructor_remove(void(*destructor)(void))
void M_library_cleanup(void)
size_t M_thread_count(void)
M_bool M_thread_destructor_insert(void(*destructor)(void))
@ M_THREAD_MODEL_COOP
Definition: m_thread.h:111
@ M_THREAD_MODEL_INVALID
Definition: m_thread.h:109
@ M_THREAD_MODEL_NATIVE
Definition: m_thread.h:110
M_bool M_thread_mutex_unlock(M_thread_mutex_t *mutex)
M_thread_mutex_t * M_thread_mutex_create(M_uint32 attr)
void M_thread_mutex_destroy(M_thread_mutex_t *mutex)
M_thread_mutexattr_t
Definition: m_thread.h:432
M_bool M_thread_mutex_trylock(M_thread_mutex_t *mutex)
struct M_thread_mutex M_thread_mutex_t
Definition: m_thread.h:427
M_bool M_thread_mutex_lock(M_thread_mutex_t *mutex)
@ M_THREAD_MUTEXATTR_NONE
Definition: m_thread.h:433
@ M_THREAD_MUTEXATTR_RECURSIVE
Definition: m_thread.h:434
M_bool initialized
Definition: m_thread.h:768
M_thread_spinlock_t spinlock
Definition: m_thread.h:769
M_bool M_thread_once(M_thread_once_t *once_control, void(*init_routine)(M_uint64 flags), M_uint64 init_flags)
M_bool M_thread_once_reset(M_thread_once_t *once_control)
Definition: m_thread.h:767
struct M_thread_rwlock M_thread_rwlock_t
Definition: m_thread.h:601
void M_thread_rwlock_destroy(M_thread_rwlock_t *rwlock)
M_thread_rwlock_type_t
Definition: m_thread.h:605
M_bool M_thread_rwlock_lock(M_thread_rwlock_t *rwlock, M_thread_rwlock_type_t type)
M_thread_rwlock_t * M_thread_rwlock_create(void)
M_bool M_thread_rwlock_unlock(M_thread_rwlock_t *rwlock)
@ M_THREAD_RWLOCK_TYPE_READ
Definition: m_thread.h:606
@ M_THREAD_RWLOCK_TYPE_WRITE
Definition: m_thread.h:607
M_threadid_t threadid
Definition: m_thread.h:713
volatile M_uint32 queue
Definition: m_thread.h:712
volatile M_uint32 current
Definition: m_thread.h:711
void M_thread_spinlock_lock(M_thread_spinlock_t *spinlock)
void M_thread_spinlock_unlock(M_thread_spinlock_t *spinlock)
Definition: m_thread.h:710
M_uint64 M_thread_tls_key_t
Definition: m_thread.h:666
M_thread_tls_key_t M_thread_tls_key_create(void(*destructor)(void *))
M_bool M_thread_tls_setspecific(M_thread_tls_key_t key, const void *value)
void * M_thread_tls_getspecific(M_thread_tls_key_t key)