Show More
@@ -1,6 +1,7 b'' | |||
|
1 | 1 | # Standard library imports. |
|
2 | 2 | import ctypes |
|
3 | 3 | import os |
|
4 | import platform | |
|
4 | 5 | import time |
|
5 | 6 | from thread import interrupt_main |
|
6 | 7 | from threading import Thread |
@@ -100,12 +101,14 b' class ParentPollerWindows(Thread):' | |||
|
100 | 101 | handles.append(self.interrupt_handle) |
|
101 | 102 | if self.parent_handle: |
|
102 | 103 | handles.append(self.parent_handle) |
|
104 | arch = platform.architecture()[0] | |
|
105 | c_int = ctypes.c_int64 if arch.startswith('64') else ctypes.c_int | |
|
103 | 106 | |
|
104 | 107 | # Listen forever. |
|
105 | 108 | while True: |
|
106 | 109 | result = ctypes.windll.kernel32.WaitForMultipleObjects( |
|
107 | 110 | len(handles), # nCount |
|
108 |
( |
|
|
111 | (c_int * len(handles))(*handles), # lpHandles | |
|
109 | 112 | False, # bWaitAll |
|
110 | 113 | INFINITE) # dwMilliseconds |
|
111 | 114 | |
@@ -117,3 +120,8 b' class ParentPollerWindows(Thread):' | |||
|
117 | 120 | |
|
118 | 121 | elif handle == self.parent_handle: |
|
119 | 122 | os._exit(1) |
|
123 | elif result < 0: | |
|
124 | # wait failed, but don't let this throttle CPU | |
|
125 | # if this is going to repeat, perhaps we should | |
|
126 | # just give up and return. | |
|
127 | time.sleep(.1) |
General Comments 0
You need to be logged in to leave comments.
Login now