- Timestamp:
- Nov 20, 2008 1:27:06 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/linux/semevent-linux.cpp
r10839 r14412 120 120 * Invalidate the semaphore and wake up anyone waiting on it. 121 121 */ 122 ASMAtomicXchgSize(&pThis->iMagic, RTSEMEVENT_MAGIC + 1);122 ASMAtomicXchgSize(&pThis->iMagic, RTSEMEVENT_MAGIC | UINT32_C(0x80000000)); 123 123 if (ASMAtomicXchgS32(&pThis->cWaiters, INT32_MIN / 2) > 0) 124 124 { … … 148 148 for (unsigned i = 0;; i++) 149 149 { 150 int32_t iCur = pThis->cWaiters; 151 if (iCur == 0) 152 { 153 if (ASMAtomicCmpXchgS32(&pThis->cWaiters, -1, 0)) 154 break; /* nobody is waiting */ 155 } 150 int32_t iCur; 151 if (ASMAtomicCmpXchgExS32(&pThis->cWaiters, -1, 0, &iCur)) 152 break; /* nobody is waiting */ 156 153 else if (iCur < 0) 157 154 break; /* already signaled */ … … 189 186 } 190 187 } 188 189 /* Check the magic to fend off races with RTSemEventDestroy. */ 190 if (RT_UNLIKELY(pThis->iMagic != RTSEMEVENT_MAGIC)) 191 return VERR_SEM_DESTROYED; 191 192 } 192 193 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.