diff options
Diffstat (limited to 'nsprpub/pr/include')
-rw-r--r-- | nsprpub/pr/include/md/_pth.h | 71 | ||||
-rw-r--r-- | nsprpub/pr/include/prinet.h | 2 | ||||
-rw-r--r-- | nsprpub/pr/include/prinit.h | 4 | ||||
-rw-r--r-- | nsprpub/pr/include/private/primpl.h | 22 |
4 files changed, 79 insertions, 20 deletions
diff --git a/nsprpub/pr/include/md/_pth.h b/nsprpub/pr/include/md/_pth.h index 5603223a08..eeeef04387 100644 --- a/nsprpub/pr/include/md/_pth.h +++ b/nsprpub/pr/include/md/_pth.h @@ -14,7 +14,29 @@ #define _PR_MD_DISABLE_CLOCK_INTERRUPTS() #define _PR_MD_ENABLE_CLOCK_INTERRUPTS() -#if defined(BSDI) +/* In good standards fashion, the DCE threads (based on posix-4) are not + * quite the same as newer posix implementations. These are mostly name + * changes and small differences, so macros usually do the trick + */ +#ifdef _PR_DCETHREADS +#define _PT_PTHREAD_MUTEXATTR_INIT pthread_mutexattr_create +#define _PT_PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_delete +#define _PT_PTHREAD_MUTEX_INIT(m, a) pthread_mutex_init(&(m), a) +#define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (0 == pthread_mutex_trylock(&(m))) +#define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_create +#define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), a) +#define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_delete + +/* Notes about differences between DCE threads and pthreads 10: + * 1. pthread_mutex_trylock returns 1 when it locks the mutex + * 0 when it does not. The latest pthreads has a set of errno-like + * return values. + * 2. return values from pthread_cond_timedwait are different. + * + * + * + */ +#elif defined(BSDI) /* * Mutex and condition attributes are not supported. The attr * argument to pthread_mutex_init() and pthread_cond_init() must @@ -84,7 +106,13 @@ * PR_EnterMonitor calls any of these functions, infinite * recursion ensues. */ -#if defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \ +#if defined(_PR_DCETHREADS) +#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) \ + memset(&(t), 0, sizeof(pthread_t)) +#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) \ + (!memcmp(&(t), &pt_zero_tid, sizeof(pthread_t))) +#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st) +#elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \ || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ || defined(HPUX) || defined(FREEBSD) \ || defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \ @@ -97,7 +125,17 @@ #error "pthreads is not supported for this architecture" #endif -#if defined(_PR_PTHREADS) +#if defined(_PR_DCETHREADS) +#define _PT_PTHREAD_ATTR_INIT pthread_attr_create +#define _PT_PTHREAD_ATTR_DESTROY pthread_attr_delete +#define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, a, f, r) +#define _PT_PTHREAD_KEY_CREATE pthread_keycreate +#define _PT_PTHREAD_ATTR_SETSCHEDPOLICY pthread_attr_setsched +#define _PT_PTHREAD_ATTR_GETSTACKSIZE(a, s) \ + (*(s) = pthread_attr_getstacksize(*(a)), 0) +#define _PT_PTHREAD_GETSPECIFIC(k, r) \ + pthread_getspecific((k), (pthread_addr_t *) &(r)) +#elif defined(_PR_PTHREADS) #define _PT_PTHREAD_ATTR_INIT pthread_attr_init #define _PT_PTHREAD_ATTR_DESTROY pthread_attr_destroy #define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, &a, f, r) @@ -109,6 +147,22 @@ #error "Cannot determine pthread strategy" #endif +#if defined(_PR_DCETHREADS) +#define _PT_PTHREAD_EXPLICIT_SCHED _PT_PTHREAD_DEFAULT_SCHED +#endif + +/* + * pthread_mutex_trylock returns different values in DCE threads and + * pthreads. + */ +#if defined(_PR_DCETHREADS) +#define PT_TRYLOCK_SUCCESS 1 +#define PT_TRYLOCK_BUSY 0 +#else +#define PT_TRYLOCK_SUCCESS 0 +#define PT_TRYLOCK_BUSY EBUSY +#endif + /* * These platforms don't have sigtimedwait() */ @@ -136,9 +190,16 @@ #define PT_PRIO_MIN DEFAULT_PRIO #define PT_PRIO_MAX DEFAULT_PRIO #elif defined(HPUX) + +#if defined(_PR_DCETHREADS) +#define PT_PRIO_MIN PRI_OTHER_MIN +#define PT_PRIO_MAX PRI_OTHER_MAX +#else /* defined(_PR_DCETHREADS) */ #include <sys/sched.h> #define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER) #define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER) +#endif /* defined(_PR_DCETHREADS) */ + #elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ || defined(FREEBSD) || defined(SYMBIAN) #define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER) @@ -177,7 +238,9 @@ * Needed for garbage collection -- Look at PR_Suspend/PR_Resume * implementation. */ -#if defined(OSF1) +#if defined(_PR_DCETHREADS) +#define _PT_PTHREAD_YIELD() pthread_yield() +#elif defined(OSF1) /* * sched_yield can't be called from a signal handler. Must use * the _np version. diff --git a/nsprpub/pr/include/prinet.h b/nsprpub/pr/include/prinet.h index fc9f739186..15d229fe45 100644 --- a/nsprpub/pr/include/prinet.h +++ b/nsprpub/pr/include/prinet.h @@ -54,7 +54,7 @@ struct sockaddr_dl; #endif /* XP_UNIX */ #include <netdb.h> -#if defined(BSDI) || defined(QNX) +#if defined(FREEBSD) || defined(BSDI) || defined(QNX) #include <rpc/types.h> /* the only place that defines INADDR_LOOPBACK */ #endif diff --git a/nsprpub/pr/include/prinit.h b/nsprpub/pr/include/prinit.h index c55788923b..fd935ec309 100644 --- a/nsprpub/pr/include/prinit.h +++ b/nsprpub/pr/include/prinit.h @@ -31,9 +31,9 @@ PR_BEGIN_EXTERN_C ** The format of the version string is ** "<major version>.<minor version>[.<patch level>] [<Beta>]" */ -#define PR_VERSION "4.18" +#define PR_VERSION "4.16" #define PR_VMAJOR 4 -#define PR_VMINOR 18 +#define PR_VMINOR 16 #define PR_VPATCH 0 #define PR_BETA PR_FALSE diff --git a/nsprpub/pr/include/private/primpl.h b/nsprpub/pr/include/private/primpl.h index a817c206c6..dc24a25727 100644 --- a/nsprpub/pr/include/private/primpl.h +++ b/nsprpub/pr/include/private/primpl.h @@ -6,6 +6,14 @@ #ifndef primpl_h___ #define primpl_h___ +/* + * HP-UX 10.10's pthread.h (DCE threads) includes dce/cma.h, which + * has: + * #define sigaction _sigaction_sys + * This macro causes chaos if signal.h gets included before pthread.h. + * To be safe, we include pthread.h first. + */ + #if defined(_PR_PTHREADS) #include <pthread.h> #endif @@ -1869,7 +1877,7 @@ extern PRFileDesc *_pr_stderr; ** and functions with macros that expand to the native thread ** types and functions on each platform. */ -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) #define _PR_ZONE_ALLOCATOR #endif @@ -2157,18 +2165,6 @@ extern PRUint32 connectCount; #endif /* XP_BEOS */ -#if defined(_WIN64) && defined(WIN95) -typedef struct _PRFileDescList { - PRFileDesc *fd; - struct _PRFileDescList *next; -} PRFileDescList; - -extern PRLock *_fd_waiting_for_overlapped_done_lock; -extern PRFileDescList *_fd_waiting_for_overlapped_done; -extern void CheckOverlappedPendingSocketsAreDone(); -#endif - - PR_END_EXTERN_C #endif /* primpl_h___ */ |