41 #include <sys/param.h>
45#include "UpnpUniStd.h"
53#if defined(BSD) && !defined(__GNU__)
54 #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
58#if defined(PTHREAD_MUTEX_RECURSIVE) || defined(__DragonFly__)
62 #define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_NORMAL
63 #define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
64 #define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK
66 #define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP
67 #define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP
68 #define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP
72#define ITHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
73#define ITHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
76#define ITHREAD_CANCELED PTHREAD_CANCELED
79#define ITHREAD_STACK_MIN PTHREAD_STACK_MIN
80#define ITHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
81#define ITHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
91typedef pthread_t ithread_t;
102typedef pthread_attr_t ithread_attr_t;
112typedef void (*start_routine)(
void *arg);
123typedef pthread_cond_t ithread_cond_t;
134typedef pthread_mutexattr_t ithread_mutexattr_t;
145typedef pthread_mutex_t ithread_mutex_t;
157typedef pthread_condattr_t ithread_condattr_t;
169typedef pthread_rwlockattr_t ithread_rwlockattr_t;
182 typedef pthread_rwlock_t ithread_rwlock_t;
185 typedef ithread_mutex_t ithread_rwlock_t;
200static UPNP_INLINE int ithread_initialize_library(
void) {
218static UPNP_INLINE int ithread_cleanup_library(
void) {
236static UPNP_INLINE int ithread_initialize_thread(
void) {
239#if defined(_WIN32) && defined(PTW32_STATIC_LIB)
240 ret = !pthread_win32_thread_attach_np();
258static UPNP_INLINE int ithread_cleanup_thread(
void) {
261#if defined(_WIN32) && defined(PTW32_STATIC_LIB)
262 ret = !pthread_win32_thread_detach_np();
283#define ithread_mutexattr_init pthread_mutexattr_init
300#define ithread_mutexattr_destroy pthread_mutexattr_destroy
322#if defined(PTHREAD_MUTEX_RECURSIVE) || defined(__DragonFly__)
323 #define ithread_mutexattr_setkind_np pthread_mutexattr_settype
325 #define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np
347#if defined(PTHREAD_MUTEX_RECURSIVE) || defined(__DragonFly__)
348 #define ithread_mutexattr_getkind_np pthread_mutexattr_gettype
350 #define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np
369#define ithread_mutex_init pthread_mutex_init
386#define ithread_mutex_lock pthread_mutex_lock
404#define ithread_mutex_unlock pthread_mutex_unlock
423#define ithread_mutex_destroy pthread_mutex_destroy
440 #define ithread_rwlockattr_init pthread_rwlockattr_init
458 #define ithread_rwlockattr_destroy pthread_rwlockattr_destroy
481 #define ithread_rwlockatttr_setpshared pthread_rwlockatttr_setpshared
504 #define ithread_rwlockatttr_getpshared pthread_rwlockatttr_getpshared
524 #define ithread_rwlock_init pthread_rwlock_init
527 #define ithread_rwlock_init ithread_mutex_init
545 #define ithread_rwlock_rdlock pthread_rwlock_rdlock
548 #define ithread_rwlock_rdlock ithread_mutex_lock
566 #define ithread_rwlock_wrlock pthread_rwlock_wrlock
569 #define ithread_rwlock_wrlock ithread_mutex_lock
589 #define ithread_rwlock_unlock pthread_rwlock_unlock
592 #define ithread_rwlock_unlock ithread_mutex_unlock
613 #define ithread_rwlock_destroy pthread_rwlock_destroy
616 #define ithread_rwlock_destroy ithread_mutex_destroy
633#define ithread_cond_init pthread_cond_init
650#define ithread_cond_signal pthread_cond_signal
667#define ithread_cond_broadcast pthread_cond_broadcast
688#define ithread_cond_wait pthread_cond_wait
712#define ithread_cond_timedwait pthread_cond_timedwait
729#define ithread_cond_destroy pthread_cond_destroy
743#define ithread_attr_init pthread_attr_init
757#define ithread_attr_destroy pthread_attr_destroy
773#define ithread_attr_setstacksize pthread_attr_setstacksize
789#define ithread_attr_setdetachstate pthread_attr_setdetachstate
808#define ithread_create pthread_create
822#define ithread_cancel pthread_cancel
835#define ithread_exit pthread_exit
847#define ithread_get_current_thread_id pthread_self
859#define ithread_self pthread_self
873#define ithread_detach pthread_detach
892#define ithread_join pthread_join
909 #define isleep(x) Sleep((x)*1000)
929 #define imillisleep Sleep
931 #define imillisleep(x) usleep(1000*x)
935#if !defined(PTHREAD_MUTEX_RECURSIVE) && !defined(__DragonFly__) && !defined(UPNP_USE_MSVCPP)
938EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr,
int kind);
Defines constants that for some reason are not defined on some systems.
#define EXPORT_SPEC
Export functions on WIN32 DLLs.
Definition UpnpGlobal.h:87
#define UPNP_INLINE
Declares an inline function.
Definition UpnpGlobal.h:99