VirtualBox

Changeset 63948 in vbox


Ignore:
Timestamp:
Sep 22, 2016 1:22:47 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
110834
Message:

VBoxGuest: VGDrvCommonWaitDoWakeUps must be thread-safe.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp

    r62853 r63948  
    14641464 * All entries in the wake-up list gets signalled and moved to the woken-up
    14651465 * list.
     1466 * At least on Windows this function can be invoked concurrently from
     1467 * different VCPUs. So, be thread-safe.
    14661468 *
    14671469 * @param   pDevExt         The device extension.
     
    14781480            if (!pWait)
    14791481                break;
     1482            /* Prevent other threads from accessing pWait when spinlock is released. */
     1483            RTListNodeRemove(&pWait->ListNode);
     1484
    14801485            pWait->fPendingWakeUp = true;
    14811486            RTSpinlockRelease(pDevExt->EventSpinlock);
     
    14851490
    14861491            RTSpinlockAcquire(pDevExt->EventSpinlock);
     1492            Assert(pWait->ListNode.pNext == NULL && pWait->ListNode.pPrev == NULL);
     1493            RTListAppend(&pDevExt->WokenUpList, &pWait->ListNode);
    14871494            pWait->fPendingWakeUp = false;
    1488             if (!pWait->fFreeMe)
    1489             {
    1490                 RTListNodeRemove(&pWait->ListNode);
    1491                 RTListAppend(&pDevExt->WokenUpList, &pWait->ListNode);
    1492             }
     1495            if (RT_LIKELY(!pWait->fFreeMe))
     1496            { /* likely */ }
    14931497            else
    14941498            {
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