41 #include <sys/param.h>
45#include "UpnpUniStd.h"
53#if defined(BSD) && !defined(__GNU__)
54 #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
57#if defined(PTHREAD_MUTEX_RECURSIVE) || defined(__DragonFly__)
61 #define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_NORMAL
62 #define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
63 #define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK
65 #define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP
66 #define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP
67 #define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP
70#define ITHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE
71#define ITHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED
73#define ITHREAD_CANCELED PTHREAD_CANCELED
75#define ITHREAD_STACK_MIN PTHREAD_STACK_MIN
76#define ITHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED
77#define ITHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE
87typedef pthread_t ithread_t;
97typedef pthread_attr_t ithread_attr_t;
106typedef void (*start_routine)(
void *arg);
116typedef pthread_cond_t ithread_cond_t;
126typedef pthread_mutexattr_t ithread_mutexattr_t;
136typedef pthread_mutex_t ithread_mutex_t;
147typedef pthread_condattr_t ithread_condattr_t;
158typedef pthread_rwlockattr_t ithread_rwlockattr_t;
174#ifndef INTERNAL_CONFIG_H
178typedef pthread_rwlock_t ithread_rwlock_t;
181typedef ithread_mutex_t ithread_rwlock_t;
195static UPNP_INLINE int ithread_initialize_library(
void)
213static UPNP_INLINE int ithread_cleanup_library(
void)
231static UPNP_INLINE int ithread_initialize_thread(
void)
235#if defined(_WIN32) && defined(PTW32_STATIC_LIB)
236 ret = !pthread_win32_thread_attach_np();
257#if defined(_WIN32) && defined(PTW32_STATIC_LIB)
258 ret = !pthread_win32_thread_detach_np();
278#define ithread_mutexattr_init pthread_mutexattr_init
294#define ithread_mutexattr_destroy pthread_mutexattr_destroy
315#define ithread_mutexattr_setkind_np pthread_mutexattr_settype
316#define ithread_mutexattr_settype pthread_mutexattr_settype
337#define ithread_mutexattr_getkind_np pthread_mutexattr_gettype
338#define ithread_mutexattr_gettype pthread_mutexattr_gettype
358#define ithread_mutex_init pthread_mutex_init
375#define ithread_mutex_lock pthread_mutex_lock
392#define ithread_mutex_unlock pthread_mutex_unlock
411#define ithread_mutex_destroy pthread_mutex_destroy
427 #define ithread_rwlockattr_init pthread_rwlockattr_init
444 #define ithread_rwlockattr_destroy pthread_rwlockattr_destroy
466 #define ithread_rwlockatttr_setpshared pthread_rwlockatttr_setpshared
488 #define ithread_rwlockatttr_getpshared pthread_rwlockatttr_getpshared
509 #define ithread_rwlock_init pthread_rwlock_init
512 #define ithread_rwlock_init ithread_mutex_init
530 #define ithread_rwlock_rdlock pthread_rwlock_rdlock
533 #define ithread_rwlock_rdlock ithread_mutex_lock
551 #define ithread_rwlock_wrlock pthread_rwlock_wrlock
554 #define ithread_rwlock_wrlock ithread_mutex_lock
573 #define ithread_rwlock_unlock pthread_rwlock_unlock
576 #define ithread_rwlock_unlock ithread_mutex_unlock
599 #define ithread_rwlock_destroy pthread_rwlock_destroy
602 #define ithread_rwlock_destroy ithread_mutex_destroy
618#define ithread_cond_init pthread_cond_init
634#define ithread_cond_signal pthread_cond_signal
650#define ithread_cond_broadcast pthread_cond_broadcast
670#define ithread_cond_wait pthread_cond_wait
693#define ithread_cond_timedwait pthread_cond_timedwait
709#define ithread_cond_destroy pthread_cond_destroy
723#define ithread_attr_init pthread_attr_init
737#define ithread_attr_destroy pthread_attr_destroy
753#define ithread_attr_setstacksize pthread_attr_setstacksize
769#define ithread_attr_setdetachstate pthread_attr_setdetachstate
788#define ithread_create pthread_create
801#define ithread_cancel pthread_cancel
813#define ithread_exit pthread_exit
824#define ithread_get_current_thread_id pthread_self
835#define ithread_self pthread_self
848#define ithread_detach pthread_detach
866#define ithread_join pthread_join
882 #define isleep(x) Sleep((x) * 1000)
901 #define imillisleep Sleep
903 #if _POSIX_C_SOURCE < 200809L
904 #define imillisleep(x) usleep(1000 * x)
906 #define imillisleep(x) \
908 const struct timespec req = { \
909 0, x * 1000 * 1000}; \
910 nanosleep(&req, NULL); \
915#if !defined(PTHREAD_MUTEX_RECURSIVE) && !defined(__DragonFly__) && \
916 !defined(UPNP_USE_MSVCPP)
921 pthread_mutexattr_t *attr,
int kind);
Defines constants that for some reason are not defined on some systems.
#define UPNP_EXPORT_SPEC
Export functions on WIN32 DLLs.
Definition UpnpGlobal.h:101
#define UPNP_INLINE
Declares an inline function.
Definition UpnpGlobal.h:115