Changeset 30552 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jul 1, 2010 12:24:21 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/solaris/semeventmulti-r0drv-solaris.c
r30491 r30552 59 59 /** Set if the event object is signaled. */ 60 60 uint8_t volatile fSignaled; 61 /** The number of threads in the process of waking up . */61 /** The number of threads in the process of waking up, doubles up as a ref counter. */ 62 62 uint32_t volatile cWaking; 63 /** Object version indicating a valid signal event occurred. */ 64 uint32_t volatile u32Version; 63 65 /** The Solaris mutex protecting this structure and pairing up the with the cv. */ 64 66 kmutex_t Mtx; … … 90 92 pThis->cWaking = 0; 91 93 pThis->fSignaled = 0; 94 pThis->u32Version = 0; 92 95 mutex_init(&pThis->Mtx, "IPRT Multiple Release Event Semaphore", MUTEX_DRIVER, (void *)ipltospl(DISP_LEVEL)); 93 96 cv_init(&pThis->Cnd, "IPRT CV", CV_DRIVER, NULL); … … 168 171 ASMAtomicXchgU32(&pThis->cWaking, pThis->cWaking + pThis->cWaiters); 169 172 ASMAtomicXchgU32(&pThis->cWaiters, 0); 173 ASMAtomicIncU32(&pThis->u32Version); 170 174 cv_broadcast(&pThis->Cnd); 171 175 } … … 265 269 else 266 270 { 271 ASMAtomicIncU32(&pThis->cWaiters); 267 272 for (;;) 268 273 { 269 uint32_t cWakingBeforeWait = ASMAtomicUoReadU32((uint32_t volatile *)&pThis->cWaking); 270 ASMAtomicIncU32(&pThis->cWaiters); 274 uint32_t u32VersionBeforeWait = ASMAtomicUoReadU32((uint32_t volatile *)&pThis->u32Version); 271 275 rc = rtSemEventMultiWaitWorker(pThis, cMillies, fInterruptible); 276 uint32_t u32Version = ASMAtomicUoReadU32((uint32_t volatile *)&pThis->u32Version); 272 277 if (rc > 0) 273 278 { 274 /* Retured due to call to cv_signal() or cv_broadcast() */275 279 if (RT_LIKELY(pThis->u32Magic == RTSEMEVENTMULTI_MAGIC)) 276 280 { 277 uint32_t cWaking = ASMAtomicUoReadU32((uint32_t volatile *)&pThis->cWaking);278 if ( cWaking > cWakingBeforeWait)281 /* Retured due to call to cv_signal() or cv_broadcast() */ 282 if (u32Version > u32VersionBeforeWait) 279 283 { 280 284 rc = VINF_SUCCESS; … … 290 294 else 291 295 { 296 /* We're being destroyed */ 292 297 rc = VERR_SEM_DESTROYED; 293 298 if (!ASMAtomicDecU32(&pThis->cWaking))
Note:
See TracChangeset
for help on using the changeset viewer.