- Timestamp:
- Nov 22, 2023 10:33:40 AM (15 months ago)
- Location:
- trunk/src/libs/xpcom18a4/nsprpub/pr
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h
r102241 r102242 39 39 #define primpl_h___ 40 40 41 /*42 * HP-UX 10.10's pthread.h (DCE threads) includes dce/cma.h, which43 * has:44 * #define sigaction _sigaction_sys45 * This macro causes chaos if signal.h gets included before pthread.h.46 * To be safe, we include pthread.h first.47 */48 49 #include <pthread.h>50 51 41 #include "nspr.h" 52 53 42 #include "md/prosdep.h" 54 43 55 PR_BEGIN_EXTERN_C56 57 typedef struct _MDLock _MDLock;58 typedef struct _MDCVar _MDCVar;59 60 typedef struct PRLock PRLock;61 typedef struct PRCondVar PRCondVar;62 63 /*64 ** The following definitions are unique to implementing NSPR using pthreads.65 ** Since pthreads defines most of the thread and thread synchronization66 ** stuff, this is a pretty small set.67 */68 69 #define PT_CV_NOTIFIED_LENGTH 670 typedef struct _PT_Notified _PT_Notified;71 struct _PT_Notified72 {73 PRIntn length; /* # of used entries in this structure */74 struct75 {76 PRCondVar *cv; /* the condition variable notified */77 PRIntn times; /* and the number of times notified */78 } cv[PT_CV_NOTIFIED_LENGTH];79 _PT_Notified *link; /* link to another of these | NULL */80 };81 82 /************************************************************************/83 /*************************************************************************84 ** The remainder of the definitions are shared by pthreads and the classic85 ** NSPR code. These too may be conditionalized.86 *************************************************************************/87 /************************************************************************/88 89 struct PRLock {90 pthread_mutex_t mutex; /* the underlying lock */91 _PT_Notified notified; /* array of conditions notified */92 PRBool locked; /* whether the mutex is locked */93 pthread_t owner; /* if locked, current lock owner */94 };95 96 struct PRCondVar {97 PRLock *lock; /* associated lock that protects the condition */98 pthread_cond_t cv; /* underlying pthreads condition */99 volatile int32_t notify_pending; /* CV has destroy pending notification */100 };101 102 /************************************************************************/103 104 struct PRMonitor {105 const char* name; /* monitor name for debugging */106 PRLock lock; /* the lock structure */107 pthread_t owner; /* the owner of the lock or invalid */108 PRCondVar *cvar; /* condition variable queue */109 PRUint32 entryCount; /* # of times re-entered */110 };111 112 /************************************************************************/113 114 PR_END_EXTERN_C115 116 44 #endif /* primpl_h___ */ -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptsynch.c
r102241 r102242 105 105 #endif 106 106 107 typedef struct PRLock PRLock; 108 typedef struct PRCondVar PRCondVar; 109 110 #define PT_CV_NOTIFIED_LENGTH 6 111 typedef struct _PT_Notified _PT_Notified; 112 struct _PT_Notified 113 { 114 PRIntn length; /* # of used entries in this structure */ 115 struct 116 { 117 PRCondVar *cv; /* the condition variable notified */ 118 PRIntn times; /* and the number of times notified */ 119 } cv[PT_CV_NOTIFIED_LENGTH]; 120 _PT_Notified *link; /* link to another of these | NULL */ 121 }; 122 123 struct PRLock { 124 pthread_mutex_t mutex; /* the underlying lock */ 125 _PT_Notified notified; /* array of conditions notified */ 126 PRBool locked; /* whether the mutex is locked */ 127 pthread_t owner; /* if locked, current lock owner */ 128 }; 129 130 struct PRCondVar { 131 PRLock *lock; /* associated lock that protects the condition */ 132 pthread_cond_t cv; /* underlying pthreads condition */ 133 volatile int32_t notify_pending; /* CV has destroy pending notification */ 134 }; 135 136 struct PRMonitor { 137 const char* name; /* monitor name for debugging */ 138 PRLock lock; /* the lock structure */ 139 pthread_t owner; /* the owner of the lock or invalid */ 140 PRCondVar *cvar; /* condition variable queue */ 141 PRUint32 entryCount; /* # of times re-entered */ 142 }; 143 144 107 145 static pthread_mutexattr_t _pt_mattr; 108 146 static pthread_condattr_t _pt_cvar_attr;
Note:
See TracChangeset
for help on using the changeset viewer.