Changeset 25373 in vbox for trunk/src/VBox/Runtime/generic
- Timestamp:
- Dec 14, 2009 7:20:27 PM (15 years ago)
- Location:
- trunk/src/VBox/Runtime/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/generic/critsect-generic.cpp
r25368 r25373 244 244 ASMAtomicWriteHandle(&pCritSect->NativeThreadOwner, NativeThreadSelf); 245 245 #ifdef RTCRITSECT_STRICT 246 RT LockValidatorSetOwner(pCritSect->pValidatorRec, ThreadSelf, uId, RT_SRC_POS_ARGS);246 RTThreadWriteLockInc(RTLockValidatorSetOwner(pCritSect->pValidatorRec, ThreadSelf, uId, RT_SRC_POS_ARGS)); 247 247 #endif 248 248 … … 283 283 RTNATIVETHREAD NativeThreadSelf = RTThreadNativeSelf(); 284 284 #ifdef RTCRITSECT_STRICT 285 RTTHREAD ThreadSelf = RTThreadSelf(); 286 if (ThreadSelf == NIL_RTTHREAD) 287 RTThreadAdopt(RTTHREADTYPE_DEFAULT, 0, NULL, &ThreadSelf); 288 RTLockValidatorCheckOrder(pCritSect->pValidatorRec, ThreadSelf, uId, RT_SRC_POS_ARGS); 285 RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt(); 286 RTLockValidatorCheckOrder(pCritSect->pValidatorRec, hThreadSelf, uId, RT_SRC_POS_ARGS); 289 287 #endif 290 288 … … 315 313 } 316 314 315 /* 316 * Wait for the current owner to release it. 317 */ 318 #ifndef RTCRITSECT_STRICT 319 RTTHREAD hThreadSelf = RTThreadSelf(); 320 #endif 317 321 for (;;) 318 322 { 319 #ifdef RTCRITSECT_STRICT 320 RTThreadBlocking(ThreadSelf, RTTHREADSTATE_CRITSECT, pCritSect->pValidatorRec, uId, RT_SRC_POS_ARGS); 321 #endif 323 RTThreadBlocking(hThreadSelf, RTTHREADSTATE_CRITSECT, RTCRITSECT_STRICT_BLOCK_ARGS(pCritSect->pValidatorRec)); 322 324 int rc = RTSemEventWait(pCritSect->EventSem, RT_INDEFINITE_WAIT); 323 #ifdef RTCRITSECT_STRICT 324 RTThreadUnblocked(ThreadSelf, RTTHREADSTATE_CRITSECT); 325 #endif 325 RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_CRITSECT); 326 326 if (pCritSect->u32Magic != RTCRITSECT_MAGIC) 327 327 return VERR_SEM_DESTROYED; … … 339 339 ASMAtomicWriteHandle(&pCritSect->NativeThreadOwner, NativeThreadSelf); 340 340 #ifdef RTCRITSECT_STRICT 341 RTLockValidatorSetOwner(pCritSect->pValidatorRec, ThreadSelf, uId, RT_SRC_POS_ARGS); 342 RTThreadWriteLockInc(ThreadSelf); 341 RTThreadWriteLockInc(RTLockValidatorSetOwner(pCritSect->pValidatorRec, hThreadSelf, uId, RT_SRC_POS_ARGS)); 343 342 #endif 344 343 … … 393 392 */ 394 393 #ifdef RTCRITSECT_STRICT 395 RT LockValidatorUnsetOwner(pCritSect->pValidatorRec);394 RTThreadWriteLockInc(RTLockValidatorUnsetOwner(pCritSect->pValidatorRec)); 396 395 #endif 397 396 ASMAtomicWriteHandle(&pCritSect->NativeThreadOwner, NIL_RTNATIVETHREAD); -
trunk/src/VBox/Runtime/generic/semnoint-generic.cpp
r21337 r25373 126 126 RT_EXPORT_SYMBOL(RTSemMutexRequest); 127 127 128 129 RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX Mutex, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 130 { 131 int rc; 132 if (cMillies == RT_INDEFINITE_WAIT) 133 { 134 do rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS); 135 while (rc == VERR_INTERRUPTED); 136 } 137 else 138 { 139 const uint64_t u64Start = RTTimeMilliTS(); 140 rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies, uId, RT_SRC_POS_ARGS); 141 if (rc == VERR_INTERRUPTED) 142 { 143 do 144 { 145 uint64_t u64Elapsed = RTTimeMilliTS() - u64Start; 146 if (u64Elapsed >= cMillies) 147 return VERR_TIMEOUT; 148 rc = RTSemMutexRequestNoResumeDebug(Mutex, cMillies - (unsigned)u64Elapsed, uId, RT_SRC_POS_ARGS); 149 } while (rc == VERR_INTERRUPTED); 150 } 151 } 152 return rc; 153 } 154 RT_EXPORT_SYMBOL(RTSemMutexRequestDebug); 155
Note:
See TracChangeset
for help on using the changeset viewer.