VirtualBox

Changeset 5540 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Oct 27, 2007 12:20:26 PM (17 years ago)
Author:
vboxsync
Message:

Don't wait indefinitely in case the request was copmleted at just the wrong time

File:
1 edited

Legend:

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

    r4777 r5540  
    339339{
    340340    PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvData;
     341    LARGE_INTEGER timeout;
    341342
    342343    dprintf(("VBoxHGCMCallback\n"));
    343344       
    344     // this code is subject to "lost wakeup" bug
    345     // -- malc
     345    /* Possible problem with requestion completion right between the fu32Flags check and KeWaitForSingleObject
     346     * call; introduce a timeout to make sure we don't wait indefinitely.
     347     */
     348    timeout.QuadPart  = 250;
     349    timeout.QuadPart *= -10000;     /* relative in 100ns units */
     350
    346351    while ((pHeader->fu32Flags & VBOX_HGCM_REQ_DONE) == 0)
    347352    {
    348353        /* Specifying UserMode so killing the user process will abort the wait. */
    349354        NTSTATUS rc = KeWaitForSingleObject (&pDevExt->keventNotification, Executive,
    350                                              UserMode, TRUE, NULL /** @todo &timeout? */
     355                                             UserMode, TRUE, &timeout
    351356                                            );
    352         dprintf(("VBoxHGCMCallback: Wait returned %d\n", rc));
     357        dprintf(("VBoxHGCMCallback: Wait returned %d fu32Flags=%x\n", rc, pHeader->fu32Flags));
     358
     359        if (rc == STATUS_TIMEOUT)
     360            continue;
    353361
    354362        if (rc != STATUS_WAIT_0)
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