Changeset 45309 in vbox for trunk/src/VBox/Runtime/generic
- Timestamp:
- Apr 3, 2013 2:40:35 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 84716
- Location:
- trunk/src/VBox/Runtime/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/generic/critsectrw-generic.cpp
r45151 r45309 408 408 409 409 if ( c > 0 410 || (u64State & RTCSRW_CNT_ RD_MASK) == 0)410 || (u64State & RTCSRW_CNT_WR_MASK) == 0) 411 411 { 412 412 /* Don't change the direction. */ … … 555 555 { 556 556 /* 557 * If only trying, undo the above writer incrementation and return. 558 */ 559 if (fTryOnly) 560 { 561 for (;;) 562 { 563 u64OldState = u64State = ASMAtomicReadU64(&pThis->u64State); 564 uint64_t c = (u64State & RTCSRW_CNT_WR_MASK) >> RTCSRW_CNT_WR_SHIFT; Assert(c > 0); 565 c--; 566 u64State &= ~RTCSRW_CNT_WR_MASK; 567 u64State |= c << RTCSRW_CNT_WR_SHIFT; 568 if (ASMAtomicCmpXchgU64(&pThis->u64State, u64State, u64OldState)) 569 break; 570 } 571 return VERR_SEM_BUSY; 572 } 573 574 /* 557 575 * Wait for our turn. 558 576 */ … … 561 579 int rc; 562 580 #ifdef RTCRITSECTRW_STRICT 563 if (!fTryOnly) 564 { 565 if (hThreadSelf == NIL_RTTHREAD) 566 hThreadSelf = RTThreadSelfAutoAdopt(); 567 rc = RTLockValidatorRecExclCheckBlocking(pThis->pValidatorWrite, hThreadSelf, pSrcPos, true, 568 RT_INDEFINITE_WAIT, RTTHREADSTATE_RW_WRITE, false); 569 } 570 else 571 rc = VINF_SUCCESS; 581 if (hThreadSelf == NIL_RTTHREAD) 582 hThreadSelf = RTThreadSelfAutoAdopt(); 583 rc = RTLockValidatorRecExclCheckBlocking(pThis->pValidatorWrite, hThreadSelf, pSrcPos, true, 584 RT_INDEFINITE_WAIT, RTTHREADSTATE_RW_WRITE, false); 572 585 if (RT_SUCCESS(rc)) 573 586 #else -
trunk/src/VBox/Runtime/generic/semrw-lockless-generic.cpp
r45110 r45309 496 496 497 497 if ( c > 0 498 || (u64State & RTSEMRW_CNT_ RD_MASK) == 0)498 || (u64State & RTSEMRW_CNT_WD_MASK) == 0) 499 499 { 500 500 /* Don't change the direction. */
Note:
See TracChangeset
for help on using the changeset viewer.