VirtualBox

Changeset 4661 in vbox


Ignore:
Timestamp:
Sep 10, 2007 12:25:56 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
24308
Message:

Use poll for the host serial port driver to reduce cpu useage.

File:
1 edited

Legend:

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

    r4372 r4661  
    4545# include <string.h>
    4646# include <unistd.h>
     47# include <sys/poll.h>
    4748#elif defined(RT_OS_WINDOWS)
    4849# include <windows.h>
     
    441442        {
    442443            /* Get a block of data from the host serial device. */
    443             size_t cbRead;
     444            size_t        cbRead;
     445
     446#ifdef RT_OS_LINUX
     447            struct pollfd pfd;
     448
     449            pfd.fd = pData->DeviceFile;
     450            pfd.events = POLLIN;
     451
     452            rc = poll(&pfd, 1, -1);
     453            if (rc < 0)
     454                break;
     455#endif
     456
    444457            rc = RTFileRead(pData->DeviceFile, abBuffer, sizeof(abBuffer), &cbRead);
    445458            if (VBOX_FAILURE(rc))
     
    448461                break;
    449462            }
     463            Log(("Host Serial Driver: Read %d bytes.\n", cbRead));
    450464            cbRemaining = cbRead;
    451465            pbBuffer = abBuffer;
     
    560574    comTimeout.ReadIntervalTimeout         = MAXDWORD;
    561575    comTimeout.ReadTotalTimeoutMultiplier  = 0;
    562     comTimeout.ReadTotalTimeoutConstant    = 0;
     576    comTimeout.ReadTotalTimeoutConstant    = 10;
    563577    comTimeout.WriteTotalTimeoutMultiplier = 0;
    564578    comTimeout.WriteTotalTimeoutConstant   = 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