VirtualBox

Changeset 25620 in vbox for trunk/include/iprt/semaphore.h


Ignore:
Timestamp:
Jan 2, 2010 10:18:07 PM (15 years ago)
Author:
vboxsync
Message:

iprt/semaphore.h: Added Debug wrappers for all the RW semaphores.

File:
1 edited

Legend:

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

    r25616 r25620  
    491491 */
    492492RTDECL(int)   RTSemRWRequestReadNoResume(RTSEMRW RWSem, unsigned cMillies);
     493
     494/**
     495 * Debug version of RTSemRWRequestRead that tracks the location.
     496 *
     497 * @returns iprt status code.
     498 * @retval  VINF_SUCCESS on success.
     499 * @retval  VERR_INTERRUPT if the wait was interrupted.
     500 * @retval  VERR_INVALID_HANDLE if RWSem is invalid.
     501 *
     502 * @param   RWSem       The Read/Write semaphore to request read access to.
     503 * @param   cMillies    The number of milliseconds to wait.
     504 * @param   uId                 Some kind of locking location ID.  Typically a
     505 *                              return address up the stack.  Optional (0).
     506 * @param   pszFile             The file where the lock is being acquired from.
     507 *                              Optional.
     508 * @param   iLine               The line number in that file.  Optional (0).
     509 * @param   pszFunction         The functionn where the lock is being acquired
     510 *                              from.  Optional.
     511 */
     512RTDECL(int)   RTSemRWRequestReadDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
     513
     514/**
     515 * Debug version of RTSemRWRequestWriteNoResume that tracks the location.
     516 *
     517 * @returns iprt status code.
     518 * @retval  VINF_SUCCESS on success.
     519 * @retval  VERR_INTERRUPT if the wait was interrupted.
     520 * @retval  VERR_INVALID_HANDLE if RWSem is invalid.
     521 *
     522 * @param   RWSem       The Read/Write semaphore to request read access to.
     523 * @param   cMillies    The number of milliseconds to wait.
     524 * @param   uId                 Some kind of locking location ID.  Typically a
     525 *                              return address up the stack.  Optional (0).
     526 * @param   pszFile             The file where the lock is being acquired from.
     527 *                              Optional.
     528 * @param   iLine               The line number in that file.  Optional (0).
     529 * @param   pszFunction         The functionn where the lock is being acquired
     530 *                              from.  Optional.
     531 */
     532RTDECL(int)   RTSemRWRequestReadNoResumeDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL);
    493533
    494534/**
     
    605645 */
    606646RTDECL(uint32_t) RTSemRWGetReadCount(RTSEMRW RWSem);
     647
     648/* Strict build: Remap the four request calls to the debug versions. */
     649#ifdef RT_STRICT
     650# ifdef ___iprt_asm_h
     651#  define RTSemRWRequestRead(pCritSect, cMillies)           RTSemRWRequestReadDebug((pCritSect), (cMillies), (uintptr_t)ASMReturnAddress(), RT_SRC_POS)
     652#  define RTSemRWRequestReadNoResume(pCritSect, cMillies)   RTSemRWRequestReadNoResumeDebug((pCritSect), (cMillies), (uintptr_t)ASMReturnAddress(), RT_SRC_POS)
     653#  define RTSemRWRequestWrite(pCritSect, cMillies)          RTSemRWRequestWriteDebug((pCritSect), (cMillies), (uintptr_t)ASMReturnAddress(), RT_SRC_POS)
     654#  define RTSemRWRequestWriteNoResume(pCritSect, cMillies)  RTSemRWRequestWriteNoResumeDebug((pCritSect), (cMillies), (uintptr_t)ASMReturnAddress(), RT_SRC_POS)
     655# else
     656#  define RTSemRWRequestRead(pCritSect, cMillies)           RTSemRWRequestReadDebug((pCritSect), (cMillies), 0, RT_SRC_POS)
     657#  define RTSemRWRequestReadNoResume(pCritSect, cMillies)   RTSemRWRequestReadNoResumeDebug((pCritSect), (cMillies), 0, RT_SRC_POS)
     658#  define RTSemRWRequestWrite(pCritSect, cMillies)          RTSemRWRequestWriteDebug((pCritSect), (cMillies), 0, RT_SRC_POS)
     659#  define RTSemRWRequestWriteNoResume(pCritSect, cMillies)  RTSemRWRequestWriteNoResumeDebug((pCritSect), (cMillies), 0, RT_SRC_POS)
     660# endif
     661#endif
    607662
    608663/** @} */
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