VirtualBox

Changeset 12351 in vbox


Ignore:
Timestamp:
Sep 10, 2008 1:00:40 PM (16 years ago)
Author:
vboxsync
Message:

Host serial: Fix a bug which could cause a thread to exit after resuming a VM (Windows hosts only)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp

    r12349 r12351  
    433433
    434434#ifdef RT_OS_WINDOWS
     435    /* Make sure that the halt event sempahore is resetted. */
     436    DWORD dwRet = WaitForSingleObject(pThis->hHaltEventSem, 0);
     437
    435438    HANDLE haWait[2];
    436439    haWait[0] = pThis->hEventSend;
     
    464467            if (!WriteFile(pThis->hDeviceFile, &pThis->aSendQueue[pThis->iSendQueueTail], cbProcessed, &cbBytesWritten, &pThis->overlappedSend))
    465468            {
    466                 DWORD dwRet = GetLastError();
     469                dwRet = GetLastError();
    467470                if (dwRet == ERROR_IO_PENDING)
    468471                {
     
    472475                    dwRet = WaitForMultipleObjects(2, haWait, FALSE, INFINITE);
    473476                    if (dwRet != WAIT_OBJECT_0)
     477                    {
     478                        AssertMsg(pThread->enmState != PDMTHREADSTATE_RUNNING, ("The halt event sempahore is set but the thread is still in running state\n"));
    474479                        break;
     480                    }
    475481                }
    476482                else
     
    546552
    547553#ifdef RT_OS_WINDOWS
     554    /* Make sure that the halt event sempahore is resetted. */
     555    DWORD dwRet = WaitForSingleObject(pThis->hHaltEventSem, 0)
     556
    548557    HANDLE ahWait[2];
    549     ahWait[0] = pThis->hEventRecv;
    550     ahWait[1] = pThis->hHaltEventSem;
     558    haWait[0] = pThis->hEventRecv;
     559    haWait[1] = pThis->hHaltEventSem;
    551560#endif
    552561
     
    654663            if (!WaitCommEvent(pThis->hDeviceFile, &dwEventMask, &pThis->overlappedRecv))
    655664            {
    656                 DWORD dwRet = GetLastError();
     665                dwRet = GetLastError();
    657666                if (dwRet == ERROR_IO_PENDING)
    658667                {
     
    661670                    {
    662671                        /* notification to terminate */
     672                        AssertMsg(pThread->enmState != PDMTHREADSTATE_RUNNING, ("The halt event sempahore is set but the thread is still in running state\n"));
    663673                        break;
    664674                    }
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