##// END OF EJS Templates
handle different pointer size on x64 Windows...
Min Ragan-Kelley -
Show More
@@ -1,6 +1,7 b''
1 # Standard library imports.
1 # Standard library imports.
2 import ctypes
2 import ctypes
3 import os
3 import os
4 import platform
4 import time
5 import time
5 from thread import interrupt_main
6 from thread import interrupt_main
6 from threading import Thread
7 from threading import Thread
@@ -100,12 +101,14 b' class ParentPollerWindows(Thread):'
100 handles.append(self.interrupt_handle)
101 handles.append(self.interrupt_handle)
101 if self.parent_handle:
102 if self.parent_handle:
102 handles.append(self.parent_handle)
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 # Listen forever.
107 # Listen forever.
105 while True:
108 while True:
106 result = ctypes.windll.kernel32.WaitForMultipleObjects(
109 result = ctypes.windll.kernel32.WaitForMultipleObjects(
107 len(handles), # nCount
110 len(handles), # nCount
108 (ctypes.c_int * len(handles))(*handles), # lpHandles
111 (c_int * len(handles))(*handles), # lpHandles
109 False, # bWaitAll
112 False, # bWaitAll
110 INFINITE) # dwMilliseconds
113 INFINITE) # dwMilliseconds
111
114
@@ -117,3 +120,8 b' class ParentPollerWindows(Thread):'
117
120
118 elif handle == self.parent_handle:
121 elif handle == self.parent_handle:
119 os._exit(1)
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