Changeset 25908 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Jan 18, 2010 10:07:28 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56726
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
r25831 r25908 638 638 639 639 640 RTDECL(bool) RTSemRWIsReadOwner(RTSEMRW hRWSem, bool fWannaHear) 641 { 642 /* 643 * Validate handle. 644 */ 645 struct RTSEMRWINTERNAL *pThis = hRWSem; 646 AssertPtrReturn(pThis, false); 647 AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, false); 648 649 /* 650 * Check write ownership. The writer is also a valid reader. 651 */ 652 pthread_t Self = pthread_self(); 653 pthread_t Writer; 654 ATOMIC_GET_PTHREAD_T(&pThis->Writer, &Writer); 655 if (Writer == Self) 656 return true; 657 if (Writer != (pthread_t)-1) 658 return false; 659 660 /* 661 * If there are no readers, we cannot be one of them, can we? 662 */ 663 if (ASMAtomicReadU32(&pThis->cReaders) == 0) 664 return false; 665 666 #ifdef RTSEMRW_STRICT 667 /* 668 * Ask the lock validator. 669 */ 670 return RTLockValidatorRecSharedIsOwner(&pThis->ValidatorRead, NIL_RTTHREAD); 671 #else 672 /* 673 * Just tell the caller what he want to hear. 674 */ 675 return fWannaHear; 676 #endif 677 } 678 RT_EXPORT_SYMBOL(RTSemRWIsReadOwner); 679 680 640 681 RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW hRWSem) 641 682 {
Note:
See TracChangeset
for help on using the changeset viewer.