VirtualBox

Changeset 31604 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Aug 12, 2010 3:17:54 PM (14 years ago)
Author:
vboxsync
Message:

waitForEvents: Don't return None, another test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/glue/vboxapi.py

    r31601 r31604  
    271271    def waitForEvents(self, timeout):
    272272        from win32api import GetCurrentThreadId
     273        from win32con import INFINITE
    273274        from win32event import MsgWaitForMultipleObjects, \
    274275                               QS_ALLINPUT, WAIT_TIMEOUT, WAIT_OBJECT_0
    275276        from pythoncom import PumpWaitingMessages
    276 
     277        import types
     278
     279        if not isinstance(timeout, types.IntType):
     280            raise TypeError("The timeout argument is not an integer")
    277281        if (self.tid != GetCurrentThreadId()):
    278282            raise Exception("wait for events from the same thread you inited!")
    279283
    280         rc = MsgWaitForMultipleObjects(self.handles, 0, timeout, QS_ALLINPUT)
     284        if timeout < 0:     cMsTimeout = INFINITE
     285        else:               cMsTimeout = timeout
     286        rc = MsgWaitForMultipleObjects(self.handles, 0, cMsTimeout, QS_ALLINPUT)
    281287        if rc >= WAIT_OBJECT_0 and rc < WAIT_OBJECT_0+len(self.handles):
    282288            # is it possible?
     
    559565        Returns 1 if timed out or interrupted in some way.
    560566        Returns 2 on error (like not supported for web services).
    561         Returns None or raises an exception if called on the wrong thread or if
    562         the timeout is not an integer value.
     567
     568        Raises an exception if the calling thread is not the main thread (the one
     569        that initialized VirtualBoxManager) or if the time isn't an integer.
    563570        """
    564571        return self.platform.waitForEvents(timeout)
     
    566573    def interruptWaitEvents(self):
    567574        """
    568 
    569 
     575        Interrupt a waitForEvents call.
     576        This is normally called from a worker thread.
     577
     578        Returns True on success, False on failure.
    570579        """
    571580        return self.platform.interruptWaitEvents()
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