Go to the documentation of this file.
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 *);
52 #define PTHREAD_MUTEX_INITIALIZER _FMUTEX_INITIALIZER
67 #define PTHREAD_ONCE_INIT {0, _FMUTEX_INITIALIZER}
78 void *(*start_routine)(
void*),
92 DosWaitThread(&thread.
tid, DCWW_WAIT);
95 *value_ptr = thread.
result;
103 _fmutex_create(
mutex, 0);
110 _fmutex_close(
mutex);
117 _fmutex_request(
mutex, 0);
124 _fmutex_release(
mutex);
132 DosCreateEventSem(
NULL, &
cond->event_sem, DCE_POSTONE,
FALSE);
135 cond->wait_count = 0;
142 DosCloseEventSem(
cond->event_sem);
143 DosCloseEventSem(
cond->ack_sem);
150 if (!__atomic_cmpxchg32(&
cond->wait_count, 0, 0)) {
151 DosPostEventSem(
cond->event_sem);
152 DosWaitEventSem(
cond->ack_sem, SEM_INDEFINITE_WAIT);
160 while (!__atomic_cmpxchg32(&
cond->wait_count, 0, 0))
169 __atomic_increment(&
cond->wait_count);
173 DosWaitEventSem(
cond->event_sem, SEM_INDEFINITE_WAIT);
175 __atomic_decrement(&
cond->wait_count);
177 DosPostEventSem(
cond->ack_sem);
185 void (*init_routine)(
void))
187 if (!once_control->
done)
189 _fmutex_request(&once_control->
mtx, 0);
191 if (!once_control->
done)
195 once_control->
done = 1;
198 _fmutex_release(&once_control->
mtx);
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)
volatile unsigned wait_count
static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex)
static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex)
static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond)
static void thread_entry(void *arg)
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_once(pthread_once_t *once_control, void(*init_routine)(void))
CONDITION_VARIABLE pthread_cond_t
static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond)
static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
void *(* start_routine)(void *)
static av_always_inline int pthread_cond_signal(pthread_cond_t *cond)
static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr)
int(* cond)(enum AVPixelFormat pix_fmt)