VirtualBox

Changeset 47115 in vbox


Ignore:
Timestamp:
Jul 12, 2013 12:27:42 PM (12 years ago)
Author:
vboxsync
Message:

initterm-r0drv.cpp: RTR0TermForced must not forget to set g_crtR0Users to zero. Darwin my try _start() a _stop()'ed module more than once if _start fails.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/initterm-r0drv.cpp

    r44528 r47115  
    6565{
    6666    int rc;
     67    uint32_t cNewUsers;
    6768    Assert(fReserved == 0);
    6869    RT_ASSERT_PREEMPTIBLE();
     
    7374     * initialization races should two modules share the IPRT.
    7475     */
    75     if (ASMAtomicIncS32(&g_crtR0Users) != 1)
    76         return VINF_SUCCESS;
     76    cNewUsers = ASMAtomicIncS32(&g_crtR0Users);
     77    if (cNewUsers != 1)
     78    {
     79        if (cNewUsers > 1)
     80            return VINF_SUCCESS;
     81        ASMAtomicDecS32(&g_crtR0Users);
     82        return VERR_INTERNAL_ERROR_3;
     83    }
    7784
    7885    rc = rtR0InitNative();
     
    127134    if (cNewUsers == 0)
    128135        rtR0Term();
     136    else if (cNewUsers < 0)
     137        ASMAtomicIncS32(&g_crtR0Users);
    129138}
    130139RT_EXPORT_SYMBOL(RTR0Term);
     
    135144{
    136145    RT_ASSERT_PREEMPTIBLE();
     146
    137147    AssertMsg(g_crtR0Users == 1, ("%d\n", g_crtR0Users));
     148    ASMAtomicWriteS32(&g_crtR0Users, 0);
    138149
    139150    rtR0Term();
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