Thread handling.
System specific threading model as well as a cooperative threading model is available. Cooperative should only be used on system that do not natively support threads. Such as some embedded systems.
By default threads are created in a detached state. M_thread_attr_t must be used in order to have a thread created in a joinable state.
Example:
static M_uint32 count = 0;
static void td(void)
{
}
static void *runner(void *arg)
{
count++;
}
int main(int argc, char **argv)
{
return 0;
}
ssize_t M_printf(const char *fmt,...)
M_threadid_t M_thread_create(const M_thread_attr_t *attr, void *(*func)(void *), void *arg)
void M_thread_attr_destroy(M_thread_attr_t *attr)
M_thread_attr_t * M_thread_attr_create(void)
struct M_thread_attr M_thread_attr_t
Definition: m_thread.h:228
M_bool M_thread_join(M_threadid_t id, void **value_ptr)
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_destructor_insert(void(*destructor)(void))
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)
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