VirtualBox

Changeset 31607 in vbox for trunk/src/VBox


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

vboxapi.py: Made tdPython1.py work on windows.

File:
1 edited

Legend:

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

    r31604 r31607  
    206206            from win32con import DUPLICATE_SAME_ACCESS
    207207            from win32api import GetCurrentThread,GetCurrentThreadId,DuplicateHandle,GetCurrentProcess
     208            import threading
    208209            pid = GetCurrentProcess()
    209210            self.tid = GetCurrentThreadId()
     
    217218            win32com.client.gencache.EnsureDispatch('VirtualBox.Session')
    218219            win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox')
     220            self.oIntCv = threading.Condition()
     221            self.fInterrupted = False;
    219222
    220223    def getSessionObject(self, vbox):
     
    271274    def waitForEvents(self, timeout):
    272275        from win32api import GetCurrentThreadId
    273         from win32con import INFINITE
     276        from win32event import INFINITE
    274277        from win32event import MsgWaitForMultipleObjects, \
    275278                               QS_ALLINPUT, WAIT_TIMEOUT, WAIT_OBJECT_0
     
    295298            # Timeout
    296299            rc = 1;
     300
     301        # check for interruption
     302        self.oIntCv.acquire()
     303        if self.fInterrupted:
     304            self.fInterrupted = False
     305            rc = 1;
     306        self.oIntCv.release()
     307
    297308        return rc;
    298309
     
    309320        from win32api import PostThreadMessage
    310321        from win32con import WM_USER
    311         return PostThreadMessage(self.tid, WM_USER, None, 0xf241b819)
     322        self.oIntCv.acquire()
     323        self.fInterrupted = True
     324        self.oIntCv.release()
     325        try:
     326            PostThreadMessage(self.tid, WM_USER, None, 0xf241b819)
     327        except:
     328            return False;
     329        return True;
    312330
    313331    def deinit(self):
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