VirtualBox

Changeset 77872 in vbox for trunk/src


Ignore:
Timestamp:
Mar 25, 2019 5:16:23 PM (6 years ago)
Author:
vboxsync
Message:

Main/HostDnsServiceDarwin: Fix hang during shutdown due to m_fStop variable not being set to true during shutdown and make sure the runloop is really stopped by using CFRunLoopStop() instead of CFRunLoopWakeUp(), also use atomics when accessing m_fStop and mark it as volatile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/darwin/HostDnsServiceDarwin.cpp

    r77666 r77872  
    2020
    2121
     22#include <iprt/asm.h>
    2223#include <iprt/errcore.h>
    2324#include <iprt/thread.h>
     
    4142    CFRunLoopRef m_RunLoopRef;
    4243    CFRunLoopSourceRef m_Stopper;
    43     bool m_fStop;
     44    volatile bool m_fStop;
    4445    RTSEMEVENT m_evtStop;
    4546    static void performShutdownCallback(void *);
     
    122123    if (!m->m_fStop)
    123124    {
     125        ASMAtomicXchgBool(&m->m_fStop, true);
    124126        CFRunLoopSourceSignal(m->m_Stopper);
    125         CFRunLoopWakeUp(m->m_RunLoopRef);
     127        CFRunLoopStop(m->m_RunLoopRef);
    126128
    127129        RTSemEventWait(m->m_evtStop, RT_INDEFINITE_WAIT);
     
    153155    monitorThreadInitializationDone();
    154156
    155     while (!m->m_fStop)
     157    while (!ASMAtomicReadBool(&m->m_fStop))
    156158    {
    157159        CFRunLoopRun();
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