VirtualBox

Changeset 22579 in vbox


Ignore:
Timestamp:
Aug 30, 2009 8:36:50 PM (15 years ago)
Author:
vboxsync
Message:

Runtime/semfastmutex-r0drv-freebsd:

Replace mutexes with shared/exclusive locks because it
is not possible to sleep while holding mutexes.
Fixes warnings with WITNESS and IVNARIANTS kernel option.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/freebsd/semfastmutex-r0drv-freebsd.c

    r19565 r22579  
    5353    /** Magic value (RTSEMFASTMUTEX_MAGIC). */
    5454    uint32_t            u32Magic;
    55     /** The FreeBSD (sleep) mutex. */
    56     struct mtx          Mtx;
     55    /** The FreeBSD shared/exclusive lock mutex. */
     56    struct sx           SxLock;
    5757} RTSEMFASTMUTEXINTERNAL, *PRTSEMFASTMUTEXINTERNAL;
    5858
     
    6767    {
    6868        pFastInt->u32Magic = RTSEMFASTMUTEX_MAGIC;
    69         mtx_init(&pFastInt->Mtx, "IPRT Fast Mutex Semaphore", NULL, MTX_DEF | MTX_RECURSE);
     69        sx_init(&pFastInt->SxLock, "IPRT Fast Mutex Semaphore");
    7070        *pMutexSem = pFastInt;
    7171        return VINF_SUCCESS;
     
    8686
    8787    ASMAtomicXchgU32(&pFastInt->u32Magic, RTSEMFASTMUTEX_MAGIC_DEAD);
    88     mtx_destroy(&pFastInt->Mtx);
     88    sx_destroy(&pFastInt->SxLock);
    8989    RTMemFree(pFastInt);
    9090
     
    101101                    VERR_INVALID_PARAMETER);
    102102
    103     mtx_lock(&pFastInt->Mtx);
     103    sx_xlock(&pFastInt->SxLock);
    104104    return VINF_SUCCESS;
    105105}
     
    114114                    VERR_INVALID_PARAMETER);
    115115
    116     mtx_unlock(&pFastInt->Mtx);
     116    sx_xunlock(&pFastInt->SxLock);
    117117    return VINF_SUCCESS;
    118118}
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