diff -r 1b59c4ba121e -r 8cd4d08fa9f6 DebugClients/Python/DebugClientThreads.py --- a/DebugClients/Python/DebugClientThreads.py Fri Mar 11 08:55:14 2011 +0100 +++ b/DebugClients/Python/DebugClientThreads.py Fri Mar 11 16:51:57 2011 +0100 @@ -19,14 +19,14 @@ """ Module function used to allow for debugging of multiple threads. - The way it works is that below, we reset thread._start_new_thread to + The way it works is that below, we reset thread._start_new_thread to this function object. Thus, providing a hook for us to see when - threads are started. From here we forward the request onto the + threads are started. From here we forward the request onto the DebugClient which will create a DebugThread object to allow tracing of the thread then start up the thread. These actions are always performed in order to allow dropping into debug mode. - See DebugClientThreads.attachThread and DebugThread.DebugThread in + See DebugClientThreads.attachThread and DebugThread.DebugThread in DebugThread.py @param target the start function of the target thread (i.e. the user code) @@ -39,14 +39,15 @@ else: return _original_start_thread(target, args, kwargs) -# make thread hooks available to system +# make thread hooks available to system _original_start_thread = thread.start_new_thread thread.start_new_thread = _debugclient_start_new_thread -# NOTE: import threading here AFTER above hook, as threading cache's +# NOTE: import threading here AFTER above hook, as threading cache's # thread._start_new_thread. from threading import RLock + class DebugClientThreads(DebugClientBase.DebugClientBase, AsyncIO): """ Class implementing the client side of the debugger. @@ -74,17 +75,17 @@ self.variant = 'Threaded' - def attachThread(self, target = None, args = None, kwargs = None, mainThread = 0): + def attachThread(self, target=None, args=None, kwargs=None, mainThread=0): """ Public method to setup a thread for DebugClient to debug. - If mainThread is non-zero, then we are attaching to the already + If mainThread is non-zero, then we are attaching to the already started mainthread of the app and the rest of the args are ignored. @param target the start function of the target thread (i.e. the user code) @param args arguments to pass to target @param kwargs keyword arguments to pass to target - @param mainThread non-zero, if we are attaching to the already + @param mainThread non-zero, if we are attaching to the already started mainthread of the app @return The identifier of the created thread """ @@ -120,7 +121,7 @@ finally: self.unlockClient() - def lockClient(self, blocking = 1): + def lockClient(self, blocking=1): """ Public method to acquire the lock for this client. @@ -156,7 +157,7 @@ finally: self.unlockClient() - def eventLoop(self, disablePolling = False): + def eventLoop(self, disablePolling=False): """ Public method implementing our event loop.