26 #ifndef COMPAT_OS2THREADS_H
27 #define COMPAT_OS2THREADS_H
32 #undef __STRICT_ANSI__
35 #include <sys/builtin.h>
36 #include <sys/fmutex.h>
42 void *(*start_routine)(
void *);
65 #define PTHREAD_ONCE_INIT {0, _FMUTEX_INITIALIZER}
76 void *(*start_routine)(
void*),
90 DosWaitThread(&thread.
tid, DCWW_WAIT);
93 *value_ptr = thread.
result;
101 DosCreateMutexSem(
NULL, (PHMTX)mutex, 0,
FALSE);
108 DosCloseMutexSem(*(PHMTX)mutex);
115 DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT);
122 DosReleaseMutexSem(*(PHMTX)mutex);
141 DosCloseEventSem(cond->
ack_sem);
148 if (!__atomic_cmpxchg32(&cond->
wait_count, 0, 0)) {
150 DosWaitEventSem(cond->
ack_sem, SEM_INDEFINITE_WAIT);
158 while (!__atomic_cmpxchg32(&cond->
wait_count, 0, 0))
171 DosWaitEventSem(cond->
event_sem, SEM_INDEFINITE_WAIT);
175 DosPostEventSem(cond->
ack_sem);
183 void (*init_routine)(
void))
185 if (!once_control->
done)
187 _fmutex_request(&once_control->
mtx, 0);
189 if (!once_control->
done)
193 once_control->
done = 1;
196 _fmutex_release(&once_control->
mtx);
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
static void thread_entry(void *arg)
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
Macro definitions for various function/variable attributes.
volatile unsigned wait_count
static av_always_inline int pthread_cond_signal(pthread_cond_t *cond)
void *(* start_routine)(void *)
static av_always_inline int pthread_join(pthread_t thread, void **value_ptr)
static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
static pthread_mutex_t * mutex
static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
static av_always_inline int pthread_once(pthread_once_t *once_control, void(*init_routine)(void))