def initialize(): """Initialize the watchdog. """ global _watcherThread, isRunning if isRunning: raise RuntimeError("already running") isRunning=True # Catch application crashes. windll.kernel32.SetUnhandledExceptionFilter(_crashHandler) oledll.ole32.CoEnableCallCancellation(None) # Handle cancelled SendMessage calls. import NVDAHelper NVDAHelper._setDllFuncPointer(NVDAHelper.localLib, "_notifySendMessageCancelled", _notifySendMessageCancelled) # Monkey patch comtypes to specially handle cancelled COM calls. comtypes.COMError.__init__ = _COMError_init _coreAliveEvent.set() _resumeEvent.set() _watcherThread=threading.Thread(target=_watcher) _watcherThread.start()
def initialize(): """Initialize the watchdog. """ global _watcherThread, isRunning, _cancelCallEvent if isRunning: raise RuntimeError("already running") isRunning = True # Catch application crashes. windll.kernel32.SetUnhandledExceptionFilter(_crashHandler) oledll.ole32.CoEnableCallCancellation(None) # Cache cancelCallEvent. _cancelCallEvent = ctypes.wintypes.HANDLE.in_dll(NVDAHelper.localLib, "cancelCallEvent") # Handle cancelled SendMessage calls. NVDAHelper._setDllFuncPointer(NVDAHelper.localLib, "_notifySendMessageCancelled", _notifySendMessageCancelled) _watcherThread = threading.Thread(name=__name__, target=_watcher) alive() _watcherThread.start()
def initialize(): """Initialize the watchdog. """ global _watcherThread, isRunning if isRunning: raise RuntimeError("already running") isRunning = True # Catch application crashes. windll.kernel32.SetUnhandledExceptionFilter(_crashHandler) oledll.ole32.CoEnableCallCancellation(None) # Handle cancelled SendMessage calls. import NVDAHelper NVDAHelper._setDllFuncPointer(NVDAHelper.localLib, "_notifySendMessageCancelled", _notifySendMessageCancelled) # Monkey patch comtypes to specially handle cancelled COM calls. comtypes.COMError.__init__ = _COMError_init _coreAliveEvent.set() _resumeEvent.set() _watcherThread = threading.Thread(target=_watcher) _watcherThread.start()