43 #include <sys/param.h>
64 #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
68 #ifdef PTHREAD_MUTEX_RECURSIVE
72 #define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_NORMAL
73 #define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
74 #define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK
76 #define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP
77 #define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP
78 #define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP
82 #define ITHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
83 #define ITHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
86 #define ITHREAD_CANCELED PTHREAD_CANCELED
97 typedef pthread_t ithread_t;
108 typedef pthread_attr_t ithread_attr_t;
118 typedef void *(*start_routine)(
void *arg);
129 typedef pthread_cond_t ithread_cond_t;
140 typedef pthread_mutexattr_t ithread_mutexattr_t;
151 typedef pthread_mutex_t ithread_mutex_t;
163 typedef pthread_condattr_t ithread_condattr_t;
174 typedef pthread_rwlockattr_t ithread_rwlockattr_t;
185 typedef pthread_rwlock_t ithread_rwlock_t;
199 static UPNP_INLINE int ithread_initialize_library(
void) {
202 #if defined(WIN32) && defined(PTW32_STATIC_LIB)
203 ret = !pthread_win32_process_attach_np();
221 static UPNP_INLINE int ithread_cleanup_library(
void) {
224 #if defined(WIN32) && defined(PTW32_STATIC_LIB)
225 ret = !pthread_win32_process_detach_np();
243 static UPNP_INLINE int ithread_initialize_thread(
void) {
246 #if defined(WIN32) && defined(PTW32_STATIC_LIB)
247 ret = !pthread_win32_thread_attach_np();
265 static UPNP_INLINE int ithread_cleanup_thread(
void) {
268 #if defined(WIN32) && defined(PTW32_STATIC_LIB)
269 ret = !pthread_win32_thread_detach_np();
290 #define ithread_mutexattr_init pthread_mutexattr_init
307 #define ithread_mutexattr_destroy pthread_mutexattr_destroy
329 #ifdef PTHREAD_MUTEX_RECURSIVE
330 #define ithread_mutexattr_setkind_np pthread_mutexattr_settype
332 #define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np
354 #ifdef PTHREAD_MUTEX_RECURSIVE
355 #define ithread_mutexattr_getkind_np pthread_mutexattr_gettype
357 #define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np
376 #define ithread_mutex_init pthread_mutex_init
393 #define ithread_mutex_lock pthread_mutex_lock
411 #define ithread_mutex_unlock pthread_mutex_unlock
430 #define ithread_mutex_destroy pthread_mutex_destroy
446 #define ithread_rwlockattr_init pthread_rwlockattr_init
462 #define ithread_rwlockattr_destroy pthread_rwlockattr_destroy
483 #define ithread_rwlockatttr_setpshared pthread_rwlockatttr_setpshared
504 #define ithread_rwlockatttr_getpshared pthread_rwlockatttr_getpshared
522 #define ithread_rwlock_init pthread_rwlock_init
539 #define ithread_rwlock_rdlock pthread_rwlock_rdlock
556 #define ithread_rwlock_wrlock pthread_rwlock_wrlock
574 #define ithread_rwlock_unlock pthread_rwlock_unlock
593 #define ithread_rwlock_destroy pthread_rwlock_destroy
609 #define ithread_cond_init pthread_cond_init
626 #define ithread_cond_signal pthread_cond_signal
643 #define ithread_cond_broadcast pthread_cond_broadcast
664 #define ithread_cond_wait pthread_cond_wait
688 #define ithread_cond_timedwait pthread_cond_timedwait
705 #define ithread_cond_destroy pthread_cond_destroy
725 #define ithread_create pthread_create
739 #define ithread_cancel pthread_cancel
752 #define ithread_exit pthread_exit
764 #define ithread_get_current_thread_id pthread_self
776 #define ithread_self pthread_self
790 #define ithread_detach pthread_detach
809 #define ithread_join pthread_join
826 #define isleep(x) Sleep((x)*1000)
846 #define imillisleep Sleep
848 #define imillisleep(x) usleep(1000*x)
852 #ifndef PTHREAD_MUTEX_RECURSIVE
854 EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr,
int kind);