VirtualBox

Changeset 25723 in vbox


Ignore:
Timestamp:
Jan 11, 2010 2:28:57 PM (15 years ago)
Author:
vboxsync
Message:

iprt/RTSemRW: A little cleanup.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/semaphore.h

    r25722 r25723  
    668668 *
    669669 * @returns iprt status code.
    670  * @param   RWSem       The Read/Write semaphore to destroy.
    671  */
    672 RTDECL(int)   RTSemRWDestroy(RTSEMRW RWSem);
     670 * @param   hRWSem              Handle to the read/write semaphore.  NIL is
     671 *                              quitly ignored (VINF_SUCCESS).
     672 */
     673RTDECL(int)   RTSemRWDestroy(RTSEMRW hRWSem);
    673674
    674675/**
     
    681682 *          lock validator isn't compiled in or either of the parameters are
    682683 *          invalid.
    683  * @param   hRWSem              The handle to the read/write semaphore.
     684 * @param   hRWSem              Handle to the read/write semaphore.
    684685 * @param   uSubClass           The new sub-class value.
    685686 */
     
    692693 * @retval  VINF_SUCCESS on success.
    693694 * @retval  VERR_INTERRUPT if the wait was interrupted.
    694  * @retval  VERR_INVALID_HANDLE if RWSem is invalid.
    695  *
    696  * @param   RWSem       The Read/Write semaphore to request read access to.
    697  * @param   cMillies    The number of milliseconds to wait.
    698  */
    699 RTDECL(int)   RTSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies);
     695 * @retval  VERR_INVALID_HANDLE if hRWSem is invalid.
     696 *
     697 * @param   hRWSem              Handle to the read/write semaphore.
     698 * @param   cMillies            The number of milliseconds to wait.
     699 */
     700RTDECL(int)   RTSemRWRequestRead(RTSEMRW hRWSem, RTMSINTERVAL cMillies);
    700701
    701702/**
     
    705706 * @retval  VINF_SUCCESS on success.
    706707 * @retval  VERR_INTERRUPT if the wait was interrupted.
    707  * @retval  VERR_INVALID_HANDLE if RWSem is invalid.
    708  *
    709  * @param   RWSem       The Read/Write semaphore to request read access to.
    710  * @param   cMillies    The number of milliseconds to wait.
    711  */
    712 RTDECL(int)   RTSemRWRequestReadNoResume(RTSEMRW RWSem, unsigned cMillies);
     708 * @retval  VERR_INVALID_HANDLE if hRWSem is invalid.
     709 *
     710 * @param   hRWSem              Handle to the read/write semaphore.
     711 * @param   cMillies            The number of milliseconds to wait.
     712 */
     713RTDECL(int)   RTSemRWRequestReadNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies);
    713714
    714715/**
     
    718719 * @retval  VINF_SUCCESS on success.
    719720 * @retval  VERR_INTERRUPT if the wait was interrupted.
    720  * @retval  VERR_INVALID_HANDLE if RWSem is invalid.
    721  *
    722  * @param   RWSem       The Read/Write semaphore to request read access to.
    723  * @param   cMillies    The number of milliseconds to wait.
    724  * @param   uId                 Some kind of locking location ID.  Typically a
    725  *                              return address up the stack.  Optional (0).
    726  * @param   pszFile             The file where the lock is being acquired from.
    727  *                              Optional.
    728  * @param   iLine               The line number in that file.  Optional (0).
    729  * @param   pszFunction         The functionn where the lock is being acquired
    730  *                              from.  Optional.
    731  */
    732 RTDECL(int)   RTSemRWRequestReadDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
    733 
    734 /**
    735  * Debug version of RTSemRWRequestWriteNoResume that tracks the location.
    736  *
    737  * @returns iprt status code.
    738  * @retval  VINF_SUCCESS on success.
    739  * @retval  VERR_INTERRUPT if the wait was interrupted.
    740  * @retval  VERR_INVALID_HANDLE if RWSem is invalid.
    741  *
    742  * @param   RWSem       The Read/Write semaphore to request read access to.
    743  * @param   cMillies    The number of milliseconds to wait.
    744  * @param   uId                 Some kind of locking location ID.  Typically a
    745  *                              return address up the stack.  Optional (0).
    746  * @param   pszFile             The file where the lock is being acquired from.
    747  *                              Optional.
    748  * @param   iLine               The line number in that file.  Optional (0).
    749  * @param   pszFunction         The functionn where the lock is being acquired
    750  *                              from.  Optional.
    751  */
    752 RTDECL(int)   RTSemRWRequestReadNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
    753 
    754 /**
    755  * Release read access to a read/write semaphore.
    756  *
    757  * @returns iprt status code.
    758  * @param   RWSem       The Read/Write sempahore to release read access to.
    759  *                      Goes without saying that caller must have read access to the sem.
    760  */
    761 RTDECL(int)   RTSemRWReleaseRead(RTSEMRW RWSem);
    762 
    763 /**
    764  * Request write access to a read/write semaphore, resume on interruption.
    765  *
    766  * @returns iprt status code.
    767  * @retval  VINF_SUCCESS on success.
    768  * @retval  VERR_DEADLOCK if the caller owned the read lock.
    769  * @retval  VERR_INVALID_HANDLE if RWSem is invalid.
    770  *
    771  * @param   RWSem       The Read/Write semaphore to request write access to.
    772  * @param   cMillies    The number of milliseconds to wait.
    773  */
    774 RTDECL(int)   RTSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies);
    775 
    776 /**
    777  * Request write access to a read/write semaphore, return on interruption.
    778  *
    779  * @returns iprt status code.
    780  * @retval  VINF_SUCCESS on success.
    781  * @retval  VERR_INTERRUPT if the wait was interrupted.
    782  * @retval  VERR_DEADLOCK if the caller owned the read lock.
    783  * @retval  VERR_INVALID_HANDLE if RWSem is invalid.
    784  *
    785  * @param   RWSem       The Read/Write semaphore to request write access to.
    786  * @param   cMillies    The number of milliseconds to wait.
    787  */
    788 RTDECL(int)   RTSemRWRequestWriteNoResume(RTSEMRW RWSem, unsigned cMillies);
    789 
    790 /**
    791  * Debug version of RTSemRWRequestWrite that tracks the location.
    792  *
    793  * @returns IPRT status code, see RTSemRWRequestWrite.
    794  * @param   RWSem               The Read/Write semaphore to request write access
    795  *                              to.
     721 * @retval  VERR_INVALID_HANDLE if hRWSem is invalid.
     722 *
     723 * @param   hRWSem              Handle to the read/write semaphore.
    796724 * @param   cMillies            The number of milliseconds to wait.
    797725 * @param   uId                 Some kind of locking location ID.  Typically a
     
    803731 *                              from.  Optional.
    804732 */
    805 RTDECL(int)  RTSemRWRequestWriteDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
     733RTDECL(int)   RTSemRWRequestReadDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
    806734
    807735/**
    808736 * Debug version of RTSemRWRequestWriteNoResume that tracks the location.
    809737 *
    810  * @returns IPRT status code, see RTSemRWRequestWriteNoResume.
    811  * @param   RWSem               The Read/Write semaphore to request write access
    812  *                              to.
     738 * @returns iprt status code.
     739 * @retval  VINF_SUCCESS on success.
     740 * @retval  VERR_INTERRUPT if the wait was interrupted.
     741 * @retval  VERR_INVALID_HANDLE if hRWSem is invalid.
     742 *
     743 * @param   hRWSem              Handle to the read/write semaphore.
    813744 * @param   cMillies            The number of milliseconds to wait.
    814745 * @param   uId                 Some kind of locking location ID.  Typically a
     
    820751 *                              from.  Optional.
    821752 */
    822 RTDECL(int)  RTSemRWRequestWriteNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
     753RTDECL(int)   RTSemRWRequestReadNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
     754
     755/**
     756 * Release read access to a read/write semaphore.
     757 *
     758 * @returns iprt status code.
     759 * @param   hRWSem              Handle to the read/write semaphore.  It goes
     760 *                              without saying that caller must own read
     761 *                              privileges to the semaphore.
     762 */
     763RTDECL(int)   RTSemRWReleaseRead(RTSEMRW hRWSem);
     764
     765/**
     766 * Request write access to a read/write semaphore, resume on interruption.
     767 *
     768 * @returns iprt status code.
     769 * @retval  VINF_SUCCESS on success.
     770 * @retval  VERR_DEADLOCK if the caller owned the read lock.
     771 * @retval  VERR_INVALID_HANDLE if hRWSem is invalid.
     772 *
     773 * @param   hRWSem              Handle to the read/write semaphore.
     774 * @param   cMillies            The number of milliseconds to wait.
     775 */
     776RTDECL(int)   RTSemRWRequestWrite(RTSEMRW hRWSem, RTMSINTERVAL cMillies);
     777
     778/**
     779 * Request write access to a read/write semaphore, return on interruption.
     780 *
     781 * @returns iprt status code.
     782 * @retval  VINF_SUCCESS on success.
     783 * @retval  VERR_INTERRUPT if the wait was interrupted.
     784 * @retval  VERR_DEADLOCK if the caller owned the read lock.
     785 * @retval  VERR_INVALID_HANDLE if hRWSem is invalid.
     786 *
     787 * @param   hRWSem              Handle to the read/write semaphore.
     788 * @param   cMillies            The number of milliseconds to wait.
     789 */
     790RTDECL(int)   RTSemRWRequestWriteNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies);
     791
     792/**
     793 * Debug version of RTSemRWRequestWrite that tracks the location.
     794 *
     795 * @returns IPRT status code, see RTSemRWRequestWrite.
     796 * @param   hRWSem              Handle to the read/write semaphore.
     797 * @param   cMillies            The number of milliseconds to wait.
     798 * @param   uId                 Some kind of locking location ID.  Typically a
     799 *                              return address up the stack.  Optional (0).
     800 * @param   pszFile             The file where the lock is being acquired from.
     801 *                              Optional.
     802 * @param   iLine               The line number in that file.  Optional (0).
     803 * @param   pszFunction         The functionn where the lock is being acquired
     804 *                              from.  Optional.
     805 */
     806RTDECL(int)  RTSemRWRequestWriteDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
     807
     808/**
     809 * Debug version of RTSemRWRequestWriteNoResume that tracks the location.
     810 *
     811 * @returns IPRT status code, see RTSemRWRequestWriteNoResume.
     812 * @param   hRWSem              Handle to the read/write semaphore.
     813 * @param   cMillies            The number of milliseconds to wait.
     814 * @param   uId                 Some kind of locking location ID.  Typically a
     815 *                              return address up the stack.  Optional (0).
     816 * @param   pszFile             The file where the lock is being acquired from.
     817 *                              Optional.
     818 * @param   iLine               The line number in that file.  Optional (0).
     819 * @param   pszFunction         The functionn where the lock is being acquired
     820 *                              from.  Optional.
     821 */
     822RTDECL(int)  RTSemRWRequestWriteNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
    823823
    824824/**
     
    826826 *
    827827 * @returns iprt status code.
    828  * @param   RWSem       The Read/Write sempahore to release read access to.
    829  *                      Goes without saying that caller must have write access to the sem.
    830  */
    831 RTDECL(int)   RTSemRWReleaseWrite(RTSEMRW RWSem);
     828 * @param   hRWSem              Handle to the read/write semaphore.  Goes
     829 *                              without saying that caller must have write
     830 *                              access to the semaphore.
     831 */
     832RTDECL(int)   RTSemRWReleaseWrite(RTSEMRW hRWSem);
    832833
    833834/**
     
    835836 *
    836837 * @returns true / false accoringly.
    837  * @param   RWSem       The Read/Write semaphore in question.
    838  */
    839 RTDECL(bool)  RTSemRWIsWriteOwner(RTSEMRW RWSem);
     838 * @param   hRWSem              Handle to the read/write semaphore.
     839 */
     840RTDECL(bool)  RTSemRWIsWriteOwner(RTSEMRW hRWSem);
    840841
    841842/**
     
    843844 *
    844845 * @returns The write recursion count (0 if bad semaphore handle).
    845  * @param   RWSem       The Read/Write semaphore in question.
    846  */
    847 RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW RWSem);
     846 * @param   hRWSem              Handle to the read/write semaphore.
     847 */
     848RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW hRWSem);
    848849
    849850/**
     
    851852 *
    852853 * @returns The read recursion count (0 if bad semaphore handle).
    853  * @param   RWSem       The Read/Write semaphore in question.
    854  */
    855 RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW RWSem);
     854 * @param   hRWSem              Handle to the read/write semaphore.
     855 */
     856RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW hRWSem);
    856857
    857858/**
     
    862863 *
    863864 * @returns The read count (0 if bad semaphore handle).
    864  * @param   RWSem       The Read/Write semaphore in question.
    865  */
    866 RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW RWSem);
     865 * @param   hRWSem              Handle to the read/write semaphore.
     866 */
     867RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW hRWSem);
    867868
    868869/* Strict build: Remap the four request calls to the debug versions. */
  • trunk/src/VBox/Runtime/generic/semrw-generic.cpp

    r25711 r25723  
    170170
    171171
    172 RTDECL(int) RTSemRWDestroy(RTSEMRW RWSem)
    173 {
    174     struct RTSEMRWINTERNAL *pThis = RWSem;
     172RTDECL(int) RTSemRWDestroy(RTSEMRW hRWSem)
     173{
     174    struct RTSEMRWINTERNAL *pThis = hRWSem;
    175175
    176176    /*
     
    254254
    255255
    256 DECL_FORCE_INLINE(int) rtSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies, bool fInterruptible, PCRTLOCKVALSRCPOS pSrcPos)
     256DECL_FORCE_INLINE(int) rtSemRWRequestRead(RTSEMRW hRWSem, RTMSINTERVAL cMillies, bool fInterruptible, PCRTLOCKVALSRCPOS pSrcPos)
    257257{
    258258    /*
    259259     * Validate handle.
    260260     */
    261     struct RTSEMRWINTERNAL *pThis = RWSem;
     261    struct RTSEMRWINTERNAL *pThis = hRWSem;
    262262    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    263263    AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, VERR_INVALID_HANDLE);
     
    288288    if (RT_FAILURE(rc))
    289289    {
    290         AssertMsgFailed(("RTCritSectEnter failed on rwsem %p, rc=%Rrc\n", RWSem, rc));
     290        AssertMsgFailed(("RTCritSectEnter failed on rwsem %p, rc=%Rrc\n", hRWSem, rc));
    291291        return rc;
    292292    }
     
    374374        if (RT_FAILURE(rc) && rc != VERR_TIMEOUT) /* handle timeout below */
    375375        {
    376             AssertMsgRC(rc, ("RTSemEventMultiWait failed on rwsem %p, rc=%Rrc\n", RWSem, rc));
     376            AssertMsgRC(rc, ("RTSemEventMultiWait failed on rwsem %p, rc=%Rrc\n", hRWSem, rc));
    377377            break;
    378378        }
     
    390390        if (RT_FAILURE(rc))
    391391        {
    392             AssertMsgFailed(("RTCritSectEnter failed on rwsem %p, rc=%Rrc\n", RWSem, rc));
     392            AssertMsgFailed(("RTCritSectEnter failed on rwsem %p, rc=%Rrc\n", hRWSem, rc));
    393393            break;
    394394        }
     
    429429
    430430#undef RTSemRWRequestRead
    431 RTDECL(int) RTSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies)
     431RTDECL(int) RTSemRWRequestRead(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    432432{
    433433#ifndef RTSEMRW_STRICT
    434     return rtSemRWRequestRead(RWSem, cMillies, false, NULL);
     434    return rtSemRWRequestRead(hRWSem, cMillies, false, NULL);
    435435#else
    436436    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    437     return rtSemRWRequestRead(RWSem, cMillies, false, &SrcPos);
     437    return rtSemRWRequestRead(hRWSem, cMillies, false, &SrcPos);
    438438#endif
    439439}
     
    441441
    442442
    443 RTDECL(int) RTSemRWRequestReadDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     443RTDECL(int) RTSemRWRequestReadDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    444444{
    445445    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    446     return rtSemRWRequestRead(RWSem, cMillies, false, &SrcPos);
     446    return rtSemRWRequestRead(hRWSem, cMillies, false, &SrcPos);
    447447}
    448448RT_EXPORT_SYMBOL(RTSemRWRequestReadDebug);
     
    450450
    451451#undef RTSemRWRequestReadNoResume
    452 RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW RWSem, unsigned cMillies)
     452RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    453453{
    454454#ifndef RTSEMRW_STRICT
    455     return rtSemRWRequestRead(RWSem, cMillies, true, NULL);
     455    return rtSemRWRequestRead(hRWSem, cMillies, true, NULL);
    456456#else
    457457    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    458     return rtSemRWRequestRead(RWSem, cMillies, true, &SrcPos);
     458    return rtSemRWRequestRead(hRWSem, cMillies, true, &SrcPos);
    459459#endif
    460460}
     
    462462
    463463
    464 RTDECL(int) RTSemRWRequestReadNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     464RTDECL(int) RTSemRWRequestReadNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    465465{
    466466    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    467     return rtSemRWRequestRead(RWSem, cMillies, true, &SrcPos);
     467    return rtSemRWRequestRead(hRWSem, cMillies, true, &SrcPos);
    468468}
    469469RT_EXPORT_SYMBOL(RTSemRWRequestReadNoResumeDebug);
    470470
    471471
    472 RTDECL(int) RTSemRWReleaseRead(RTSEMRW RWSem)
    473 {
    474     struct RTSEMRWINTERNAL *pThis = RWSem;
     472RTDECL(int) RTSemRWReleaseRead(RTSEMRW hRWSem)
     473{
     474    struct RTSEMRWINTERNAL *pThis = hRWSem;
    475475
    476476    /*
     
    502502                    {
    503503                        rc = RTSemEventSignal(pThis->WriteEvent);
    504                         AssertMsgRC(rc, ("Failed to signal writers on rwsem %p, rc=%Rrc\n", RWSem, rc));
     504                        AssertMsgRC(rc, ("Failed to signal writers on rwsem %p, rc=%Rrc\n", hRWSem, rc));
    505505                    }
    506506                }
     
    543543    }
    544544    else
    545         AssertMsgFailed(("RTCritSectEnter failed on rwsem %p, rc=%Rrc\n", RWSem, rc));
     545        AssertMsgFailed(("RTCritSectEnter failed on rwsem %p, rc=%Rrc\n", hRWSem, rc));
    546546
    547547    return rc;
     
    550550
    551551
    552 DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies, bool fInterruptible, PCRTLOCKVALSRCPOS pSrcPos)
     552DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW hRWSem, RTMSINTERVAL cMillies, bool fInterruptible, PCRTLOCKVALSRCPOS pSrcPos)
    553553{
    554554    /*
    555555     * Validate handle.
    556556     */
    557     struct RTSEMRWINTERNAL *pThis = RWSem;
     557    struct RTSEMRWINTERNAL *pThis = hRWSem;
    558558    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    559559    AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, VERR_INVALID_HANDLE);
     
    581581    if (RT_FAILURE(rc))
    582582    {
    583         AssertMsgFailed(("RTCritSectEnter failed on rwsem %p, rc=%Rrc\n", RWSem, rc));
     583        AssertMsgFailed(("RTCritSectEnter failed on rwsem %p, rc=%Rrc\n", hRWSem, rc));
    584584        return rc;
    585585    }
     
    605605            pThis->fNeedResetReadEvent = false;
    606606            rc = RTSemEventMultiReset(pThis->ReadEvent);
    607             AssertMsgRC(rc, ("Failed to reset readers, rwsem %p, rc=%Rrc.\n", RWSem, rc));
     607            AssertMsgRC(rc, ("Failed to reset readers, rwsem %p, rc=%Rrc.\n", hRWSem, rc));
    608608        }
    609609
     
    665665        if (RT_UNLIKELY(RT_FAILURE_NP(rc) && rc != VERR_TIMEOUT)) /* timeouts are handled below */
    666666        {
    667             AssertMsgRC(rc, ("RTSemEventWait failed on rwsem %p, rc=%Rrc\n", RWSem, rc));
     667            AssertMsgRC(rc, ("RTSemEventWait failed on rwsem %p, rc=%Rrc\n", hRWSem, rc));
    668668            break;
    669669        }
     
    681681        if (RT_FAILURE(rc))
    682682        {
    683             AssertMsgFailed(("RTCritSectEnter failed on rwsem %p, rc=%Rrc\n", RWSem, rc));
     683            AssertMsgFailed(("RTCritSectEnter failed on rwsem %p, rc=%Rrc\n", hRWSem, rc));
    684684            break;
    685685        }
     
    694694                pThis->fNeedResetReadEvent = false;
    695695                rc = RTSemEventMultiReset(pThis->ReadEvent);
    696                 AssertMsgRC(rc, ("Failed to reset readers, rwsem %p, rc=%Rrc.\n", RWSem, rc));
     696                AssertMsgRC(rc, ("Failed to reset readers, rwsem %p, rc=%Rrc.\n", hRWSem, rc));
    697697            }
    698698
     
    735735
    736736#undef RTSemRWRequestWrite
    737 RTDECL(int) RTSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies)
     737RTDECL(int) RTSemRWRequestWrite(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    738738{
    739739#ifndef RTSEMRW_STRICT
    740     return rtSemRWRequestWrite(RWSem, cMillies, false, NULL);
     740    return rtSemRWRequestWrite(hRWSem, cMillies, false, NULL);
    741741#else
    742742    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    743     return rtSemRWRequestWrite(RWSem, cMillies, false, &SrcPos);
     743    return rtSemRWRequestWrite(hRWSem, cMillies, false, &SrcPos);
    744744#endif
    745745}
     
    747747
    748748
    749 RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     749RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    750750{
    751751    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    752     return rtSemRWRequestWrite(RWSem, cMillies, false, &SrcPos);
     752    return rtSemRWRequestWrite(hRWSem, cMillies, false, &SrcPos);
    753753}
    754754RT_EXPORT_SYMBOL(RTSemRWRequestWriteDebug);
     
    756756
    757757#undef RTSemRWRequestWriteNoResume
    758 RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW RWSem, unsigned cMillies)
     758RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    759759{
    760760#ifndef RTSEMRW_STRICT
    761     return rtSemRWRequestWrite(RWSem, cMillies, true, NULL);
     761    return rtSemRWRequestWrite(hRWSem, cMillies, true, NULL);
    762762#else
    763763    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    764     return rtSemRWRequestWrite(RWSem, cMillies, true, &SrcPos);
     764    return rtSemRWRequestWrite(hRWSem, cMillies, true, &SrcPos);
    765765#endif
    766766}
     
    768768
    769769
    770 RTDECL(int) RTSemRWRequestWriteNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     770RTDECL(int) RTSemRWRequestWriteNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    771771{
    772772    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    773     return rtSemRWRequestWrite(RWSem, cMillies, true, &SrcPos);
     773    return rtSemRWRequestWrite(hRWSem, cMillies, true, &SrcPos);
    774774}
    775775RT_EXPORT_SYMBOL(RTSemRWRequestWriteNoResumeDebug);
    776776
    777777
    778 RTDECL(int) RTSemRWReleaseWrite(RTSEMRW RWSem)
     778RTDECL(int) RTSemRWReleaseWrite(RTSEMRW hRWSem)
    779779{
    780780
     
    782782     * Validate handle.
    783783     */
    784     struct RTSEMRWINTERNAL *pThis = RWSem;
     784    struct RTSEMRWINTERNAL *pThis = hRWSem;
    785785    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    786786    AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, VERR_INVALID_HANDLE);
     
    799799    {
    800800        RTCritSectLeave(&pThis->CritSect);
    801         AssertMsgFailed(("Not read-write owner of rwsem %p.\n", RWSem));
     801        AssertMsgFailed(("Not read-write owner of rwsem %p.\n", hRWSem));
    802802        return VERR_NOT_OWNER;
    803803    }
     
    839839    {
    840840        rc = RTSemEventMultiSignal(pThis->ReadEvent);
    841         AssertMsgRC(rc, ("RTSemEventMultiSignal failed for rwsem %p, rc=%Rrc.\n", RWSem, rc));
     841        AssertMsgRC(rc, ("RTSemEventMultiSignal failed for rwsem %p, rc=%Rrc.\n", hRWSem, rc));
    842842        pThis->fNeedResetReadEvent = true;
    843843    }
     
    845845    {
    846846        rc = RTSemEventSignal(pThis->WriteEvent);
    847         AssertMsgRC(rc, ("Failed to signal writers on rwsem %p, rc=%Rrc\n", RWSem, rc));
     847        AssertMsgRC(rc, ("Failed to signal writers on rwsem %p, rc=%Rrc\n", hRWSem, rc));
    848848    }
    849849    RTCritSectLeave(&pThis->CritSect);
     
    854854
    855855
    856 RTDECL(bool) RTSemRWIsWriteOwner(RTSEMRW RWSem)
    857 {
    858     struct RTSEMRWINTERNAL *pThis = RWSem;
     856RTDECL(bool) RTSemRWIsWriteOwner(RTSEMRW hRWSem)
     857{
     858    struct RTSEMRWINTERNAL *pThis = hRWSem;
    859859
    860860    /*
     
    875875
    876876
    877 RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW RWSem)
    878 {
    879     struct RTSEMRWINTERNAL *pThis = RWSem;
     877RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW hRWSem)
     878{
     879    struct RTSEMRWINTERNAL *pThis = hRWSem;
    880880
    881881    /*
     
    893893
    894894
    895 RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW RWSem)
    896 {
    897     struct RTSEMRWINTERNAL *pThis = RWSem;
     895RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW hRWSem)
     896{
     897    struct RTSEMRWINTERNAL *pThis = hRWSem;
    898898
    899899    /*
     
    911911
    912912
    913 RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW RWSem)
     913RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW hRWSem)
    914914{
    915915    /*
    916916     * Validate input.
    917917     */
    918     struct RTSEMRWINTERNAL *pThis = RWSem;
     918    struct RTSEMRWINTERNAL *pThis = hRWSem;
    919919    AssertPtrReturn(pThis, 0);
    920920    AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
  • trunk/src/VBox/Runtime/generic/semrw-lockless-generic.cpp

    r25710 r25723  
    222222
    223223
    224 static int rtSemRWRequestRead(RTSEMRW hRWSem, unsigned cMillies, bool fInterruptible, PCRTLOCKVALSRCPOS pSrcPos)
     224static int rtSemRWRequestRead(RTSEMRW hRWSem, RTMSINTERVAL cMillies, bool fInterruptible, PCRTLOCKVALSRCPOS pSrcPos)
    225225{
    226226    /*
     
    418418
    419419#undef RTSemRWRequestRead
    420 RTDECL(int) RTSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies)
     420RTDECL(int) RTSemRWRequestRead(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    421421{
    422422#ifndef RTSEMRW_STRICT
    423     return rtSemRWRequestRead(RWSem, cMillies, false, NULL);
     423    return rtSemRWRequestRead(hRWSem, cMillies, false, NULL);
    424424#else
    425425    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    426     return rtSemRWRequestRead(RWSem, cMillies, false, &SrcPos);
     426    return rtSemRWRequestRead(hRWSem, cMillies, false, &SrcPos);
    427427#endif
    428428}
     
    430430
    431431
    432 RTDECL(int) RTSemRWRequestReadDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     432RTDECL(int) RTSemRWRequestReadDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    433433{
    434434    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    435     return rtSemRWRequestRead(RWSem, cMillies, false, &SrcPos);
     435    return rtSemRWRequestRead(hRWSem, cMillies, false, &SrcPos);
    436436}
    437437RT_EXPORT_SYMBOL(RTSemRWRequestReadDebug);
     
    439439
    440440#undef RTSemRWRequestReadNoResume
    441 RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW RWSem, unsigned cMillies)
     441RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    442442{
    443443#ifndef RTSEMRW_STRICT
    444     return rtSemRWRequestRead(RWSem, cMillies, true, NULL);
     444    return rtSemRWRequestRead(hRWSem, cMillies, true, NULL);
    445445#else
    446446    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    447     return rtSemRWRequestRead(RWSem, cMillies, true, &SrcPos);
     447    return rtSemRWRequestRead(hRWSem, cMillies, true, &SrcPos);
    448448#endif
    449449}
     
    451451
    452452
    453 RTDECL(int) RTSemRWRequestReadNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     453RTDECL(int) RTSemRWRequestReadNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    454454{
    455455    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    456     return rtSemRWRequestRead(RWSem, cMillies, true, &SrcPos);
     456    return rtSemRWRequestRead(hRWSem, cMillies, true, &SrcPos);
    457457}
    458458RT_EXPORT_SYMBOL(RTSemRWRequestReadNoResumeDebug);
     
    460460
    461461
    462 RTDECL(int) RTSemRWReleaseRead(RTSEMRW RWSem)
     462RTDECL(int) RTSemRWReleaseRead(RTSEMRW hRWSem)
    463463{
    464464    /*
    465465     * Validate handle.
    466466     */
    467     RTSEMRWINTERNAL *pThis = RWSem;
     467    RTSEMRWINTERNAL *pThis = hRWSem;
    468468    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    469469    AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, VERR_INVALID_HANDLE);
     
    534534
    535535
    536 DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW hRWSem, unsigned cMillies, bool fInterruptible, PCRTLOCKVALSRCPOS pSrcPos)
     536DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW hRWSem, RTMSINTERVAL cMillies, bool fInterruptible, PCRTLOCKVALSRCPOS pSrcPos)
    537537{
    538538    /*
     
    709709
    710710#undef RTSemRWRequestWrite
    711 RTDECL(int) RTSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies)
     711RTDECL(int) RTSemRWRequestWrite(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    712712{
    713713#ifndef RTSEMRW_STRICT
    714     return rtSemRWRequestWrite(RWSem, cMillies, false, NULL);
     714    return rtSemRWRequestWrite(hRWSem, cMillies, false, NULL);
    715715#else
    716716    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    717     return rtSemRWRequestWrite(RWSem, cMillies, false, &SrcPos);
     717    return rtSemRWRequestWrite(hRWSem, cMillies, false, &SrcPos);
    718718#endif
    719719}
     
    721721
    722722
    723 RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     723RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    724724{
    725725    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    726     return rtSemRWRequestWrite(RWSem, cMillies, false, &SrcPos);
     726    return rtSemRWRequestWrite(hRWSem, cMillies, false, &SrcPos);
    727727}
    728728RT_EXPORT_SYMBOL(RTSemRWRequestWriteDebug);
     
    730730
    731731#undef RTSemRWRequestWriteNoResume
    732 RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW RWSem, unsigned cMillies)
     732RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    733733{
    734734#ifndef RTSEMRW_STRICT
    735     return rtSemRWRequestWrite(RWSem, cMillies, true, NULL);
     735    return rtSemRWRequestWrite(hRWSem, cMillies, true, NULL);
    736736#else
    737737    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    738     return rtSemRWRequestWrite(RWSem, cMillies, true, &SrcPos);
     738    return rtSemRWRequestWrite(hRWSem, cMillies, true, &SrcPos);
    739739#endif
    740740}
     
    742742
    743743
    744 RTDECL(int) RTSemRWRequestWriteNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     744RTDECL(int) RTSemRWRequestWriteNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    745745{
    746746    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    747     return rtSemRWRequestWrite(RWSem, cMillies, true, &SrcPos);
     747    return rtSemRWRequestWrite(hRWSem, cMillies, true, &SrcPos);
    748748}
    749749RT_EXPORT_SYMBOL(RTSemRWRequestWriteNoResumeDebug);
    750750
    751751
    752 RTDECL(int) RTSemRWReleaseWrite(RTSEMRW RWSem)
     752RTDECL(int) RTSemRWReleaseWrite(RTSEMRW hRWSem)
    753753{
    754754
     
    756756     * Validate handle.
    757757     */
    758     struct RTSEMRWINTERNAL *pThis = RWSem;
     758    struct RTSEMRWINTERNAL *pThis = hRWSem;
    759759    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    760760    AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, VERR_INVALID_HANDLE);
     
    844844
    845845
    846 RTDECL(bool) RTSemRWIsWriteOwner(RTSEMRW RWSem)
     846RTDECL(bool) RTSemRWIsWriteOwner(RTSEMRW hRWSem)
    847847{
    848848    /*
    849849     * Validate handle.
    850850     */
    851     struct RTSEMRWINTERNAL *pThis = RWSem;
     851    struct RTSEMRWINTERNAL *pThis = hRWSem;
    852852    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    853853    AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, VERR_INVALID_HANDLE);
     
    864864
    865865
    866 RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW RWSem)
     866RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW hRWSem)
    867867{
    868868    /*
    869869     * Validate handle.
    870870     */
    871     struct RTSEMRWINTERNAL *pThis = RWSem;
     871    struct RTSEMRWINTERNAL *pThis = hRWSem;
    872872    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    873873    AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, VERR_INVALID_HANDLE);
     
    881881
    882882
    883 RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW RWSem)
     883RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW hRWSem)
    884884{
    885885    /*
    886886     * Validate handle.
    887887     */
    888     struct RTSEMRWINTERNAL *pThis = RWSem;
     888    struct RTSEMRWINTERNAL *pThis = hRWSem;
    889889    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    890890    AssertReturn(pThis->u32Magic == RTSEMRW_MAGIC, VERR_INVALID_HANDLE);
     
    898898
    899899
    900 RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW RWSem)
     900RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW hRWSem)
    901901{
    902902    /*
    903903     * Validate input.
    904904     */
    905     struct RTSEMRWINTERNAL *pThis = RWSem;
     905    struct RTSEMRWINTERNAL *pThis = hRWSem;
    906906    AssertPtrReturn(pThis, 0);
    907907    AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
  • trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp

    r25710 r25723  
    155155
    156156
    157 RTDECL(int) RTSemRWDestroy(RTSEMRW RWSem)
     157RTDECL(int) RTSemRWDestroy(RTSEMRW hRWSem)
    158158{
    159159    /*
    160160     * Validate input, nil handle is fine.
    161161     */
    162     struct RTSEMRWINTERNAL *pThis = RWSem;
     162    struct RTSEMRWINTERNAL *pThis = hRWSem;
    163163    if (pThis == NIL_RTSEMRW)
    164164        return VINF_SUCCESS;
     
    189189    {
    190190        ASMAtomicWriteU32(&pThis->u32Magic, RTSEMRW_MAGIC);
    191         AssertMsgFailed(("Failed to destroy read-write sem %p, rc=%d.\n", RWSem, rc));
     191        AssertMsgFailed(("Failed to destroy read-write sem %p, rc=%d.\n", hRWSem, rc));
    192192        rc = RTErrConvertFromErrno(rc);
    193193    }
     
    215215
    216216
    217 DECL_FORCE_INLINE(int) rtSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies, PCRTLOCKVALSRCPOS pSrcPos)
    218 {
    219     /*
    220      * Validate input.
    221      */
    222     struct RTSEMRWINTERNAL *pThis = RWSem;
     217DECL_FORCE_INLINE(int) rtSemRWRequestRead(RTSEMRW hRWSem, RTMSINTERVAL cMillies, PCRTLOCKVALSRCPOS pSrcPos)
     218{
     219    /*
     220     * Validate input.
     221     */
     222    struct RTSEMRWINTERNAL *pThis = hRWSem;
    223223    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    224224    AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
     
    269269        if (rc)
    270270        {
    271             AssertMsgFailed(("Failed read lock read-write sem %p, rc=%d.\n", RWSem, rc));
     271            AssertMsgFailed(("Failed read lock read-write sem %p, rc=%d.\n", hRWSem, rc));
    272272            return RTErrConvertFromErrno(rc);
    273273        }
     
    301301        if (rc)
    302302        {
    303             AssertMsg(rc == ETIMEDOUT, ("Failed read lock read-write sem %p, rc=%d.\n", RWSem, rc));
     303            AssertMsg(rc == ETIMEDOUT, ("Failed read lock read-write sem %p, rc=%d.\n", hRWSem, rc));
    304304            return RTErrConvertFromErrno(rc);
    305305        }
     
    316316
    317317#undef RTSemRWRequestRead
    318 RTDECL(int) RTSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies)
     318RTDECL(int) RTSemRWRequestRead(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    319319{
    320320#ifndef RTSEMRW_STRICT
    321     return rtSemRWRequestRead(RWSem, cMillies, NULL);
     321    return rtSemRWRequestRead(hRWSem, cMillies, NULL);
    322322#else
    323323    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    324     return rtSemRWRequestRead(RWSem, cMillies, &SrcPos);
    325 #endif
    326 }
    327 
    328 
    329 RTDECL(int) RTSemRWRequestReadDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     324    return rtSemRWRequestRead(hRWSem, cMillies, &SrcPos);
     325#endif
     326}
     327
     328
     329RTDECL(int) RTSemRWRequestReadDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    330330{
    331331    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    332     return rtSemRWRequestRead(RWSem, cMillies, &SrcPos);
     332    return rtSemRWRequestRead(hRWSem, cMillies, &SrcPos);
    333333}
    334334
    335335
    336336#undef RTSemRWRequestReadNoResume
    337 RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW RWSem, unsigned cMillies)
     337RTDECL(int) RTSemRWRequestReadNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    338338{
    339339    /* EINTR isn't returned by the wait functions we're using. */
    340340#ifndef RTSEMRW_STRICT
    341     return rtSemRWRequestRead(RWSem, cMillies, NULL);
     341    return rtSemRWRequestRead(hRWSem, cMillies, NULL);
    342342#else
    343343    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    344     return rtSemRWRequestRead(RWSem, cMillies, &SrcPos);
    345 #endif
    346 }
    347 
    348 
    349 RTDECL(int) RTSemRWRequestReadNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     344    return rtSemRWRequestRead(hRWSem, cMillies, &SrcPos);
     345#endif
     346}
     347
     348
     349RTDECL(int) RTSemRWRequestReadNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    350350{
    351351    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    352     return rtSemRWRequestRead(RWSem, cMillies, &SrcPos);
    353 }
    354 
    355 
    356 RTDECL(int) RTSemRWReleaseRead(RTSEMRW RWSem)
    357 {
    358     /*
    359      * Validate input.
    360      */
    361     struct RTSEMRWINTERNAL *pThis = RWSem;
     352    return rtSemRWRequestRead(hRWSem, cMillies, &SrcPos);
     353}
     354
     355
     356RTDECL(int) RTSemRWReleaseRead(RTSEMRW hRWSem)
     357{
     358    /*
     359     * Validate input.
     360     */
     361    struct RTSEMRWINTERNAL *pThis = hRWSem;
    362362    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    363363    AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
     
    403403    {
    404404        ASMAtomicIncU32(&pThis->cReaders);
    405         AssertMsgFailed(("Failed read unlock read-write sem %p, rc=%d.\n", RWSem, rc));
     405        AssertMsgFailed(("Failed read unlock read-write sem %p, rc=%d.\n", hRWSem, rc));
    406406        return RTErrConvertFromErrno(rc);
    407407    }
     
    410410
    411411
    412 DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies, PCRTLOCKVALSRCPOS pSrcPos)
    413 {
    414     /*
    415      * Validate input.
    416      */
    417     struct RTSEMRWINTERNAL *pThis = RWSem;
     412DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW hRWSem, RTMSINTERVAL cMillies, PCRTLOCKVALSRCPOS pSrcPos)
     413{
     414    /*
     415     * Validate input.
     416     */
     417    struct RTSEMRWINTERNAL *pThis = hRWSem;
    418418    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    419419    AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
     
    464464        if (rc)
    465465        {
    466             AssertMsgFailed(("Failed write lock read-write sem %p, rc=%d.\n", RWSem, rc));
     466            AssertMsgFailed(("Failed write lock read-write sem %p, rc=%d.\n", hRWSem, rc));
    467467            return RTErrConvertFromErrno(rc);
    468468        }
     
    495495        if (rc)
    496496        {
    497             AssertMsg(rc == ETIMEDOUT, ("Failed read lock read-write sem %p, rc=%d.\n", RWSem, rc));
     497            AssertMsg(rc == ETIMEDOUT, ("Failed read lock read-write sem %p, rc=%d.\n", hRWSem, rc));
    498498            return RTErrConvertFromErrno(rc);
    499499        }
     
    512512
    513513#undef RTSemRWRequestWrite
    514 RTDECL(int) RTSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies)
     514RTDECL(int) RTSemRWRequestWrite(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    515515{
    516516#ifndef RTSEMRW_STRICT
    517     return rtSemRWRequestWrite(RWSem, cMillies, NULL);
     517    return rtSemRWRequestWrite(hRWSem, cMillies, NULL);
    518518#else
    519519    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    520     return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos);
    521 #endif
    522 }
    523 
    524 
    525 RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     520    return rtSemRWRequestWrite(hRWSem, cMillies, &SrcPos);
     521#endif
     522}
     523
     524
     525RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    526526{
    527527    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    528     return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos);
     528    return rtSemRWRequestWrite(hRWSem, cMillies, &SrcPos);
    529529}
    530530
    531531
    532532#undef RTSemRWRequestWriteNoResume
    533 RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW RWSem, unsigned cMillies)
     533RTDECL(int) RTSemRWRequestWriteNoResume(RTSEMRW hRWSem, RTMSINTERVAL cMillies)
    534534{
    535535    /* EINTR isn't returned by the wait functions we're using. */
    536536#ifndef RTSEMRW_STRICT
    537     return rtSemRWRequestWrite(RWSem, cMillies, NULL);
     537    return rtSemRWRequestWrite(hRWSem, cMillies, NULL);
    538538#else
    539539    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API();
    540     return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos);
    541 #endif
    542 }
    543 
    544 
    545 RTDECL(int) RTSemRWRequestWriteNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
     540    return rtSemRWRequestWrite(hRWSem, cMillies, &SrcPos);
     541#endif
     542}
     543
     544
     545RTDECL(int) RTSemRWRequestWriteNoResumeDebug(RTSEMRW hRWSem, RTMSINTERVAL cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL)
    546546{
    547547    /* EINTR isn't returned by the wait functions we're using. */
    548548    RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API();
    549     return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos);
    550 }
    551 
    552 
    553 RTDECL(int) RTSemRWReleaseWrite(RTSEMRW RWSem)
    554 {
    555     /*
    556      * Validate input.
    557      */
    558     struct RTSEMRWINTERNAL *pThis = RWSem;
     549    return rtSemRWRequestWrite(hRWSem, cMillies, &SrcPos);
     550}
     551
     552
     553RTDECL(int) RTSemRWReleaseWrite(RTSEMRW hRWSem)
     554{
     555    /*
     556     * Validate input.
     557     */
     558    struct RTSEMRWINTERNAL *pThis = hRWSem;
    559559    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    560560    AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
     
    596596    if (rc)
    597597    {
    598         AssertMsgFailed(("Failed write unlock read-write sem %p, rc=%d.\n", RWSem, rc));
     598        AssertMsgFailed(("Failed write unlock read-write sem %p, rc=%d.\n", hRWSem, rc));
    599599        return RTErrConvertFromErrno(rc);
    600600    }
     
    604604
    605605
    606 RTDECL(bool) RTSemRWIsWriteOwner(RTSEMRW RWSem)
    607 {
    608     /*
    609      * Validate input.
    610      */
    611     struct RTSEMRWINTERNAL *pThis = RWSem;
     606RTDECL(bool) RTSemRWIsWriteOwner(RTSEMRW hRWSem)
     607{
     608    /*
     609     * Validate input.
     610     */
     611    struct RTSEMRWINTERNAL *pThis = hRWSem;
    612612    AssertPtrReturn(pThis, false);
    613613    AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
     
    625625
    626626
    627 RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW RWSem)
    628 {
    629     /*
    630      * Validate input.
    631      */
    632     struct RTSEMRWINTERNAL *pThis = RWSem;
     627RTDECL(uint32_t) RTSemRWGetWriteRecursion(RTSEMRW hRWSem)
     628{
     629    /*
     630     * Validate input.
     631     */
     632    struct RTSEMRWINTERNAL *pThis = hRWSem;
    633633    AssertPtrReturn(pThis, 0);
    634634    AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
     
    643643
    644644
    645 RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW RWSem)
    646 {
    647     /*
    648      * Validate input.
    649      */
    650     struct RTSEMRWINTERNAL *pThis = RWSem;
     645RTDECL(uint32_t) RTSemRWGetWriterReadRecursion(RTSEMRW hRWSem)
     646{
     647    /*
     648     * Validate input.
     649     */
     650    struct RTSEMRWINTERNAL *pThis = hRWSem;
    651651    AssertPtrReturn(pThis, 0);
    652652    AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
     
    661661
    662662
    663 RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW RWSem)
    664 {
    665     /*
    666      * Validate input.
    667      */
    668     struct RTSEMRWINTERNAL *pThis = RWSem;
     663RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW hRWSem)
     664{
     665    /*
     666     * Validate input.
     667     */
     668    struct RTSEMRWINTERNAL *pThis = hRWSem;
    669669    AssertPtrReturn(pThis, 0);
    670670    AssertMsgReturn(pThis->u32Magic == RTSEMRW_MAGIC,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette