eric4.DebugClients.Python3.DebugClientThreads

Module implementing the multithreaded version of the debug client.

Global Attributes

_original_start_thread

Classes

DebugClientThreads Class implementing the client side of the debugger.

Functions

_debugclient_start_new_thread Module function used to allow for debugging of multiple threads.


DebugClientThreads

Class implementing the client side of the debugger.

This variant of the debugger implements a threaded debugger client by subclassing all relevant base classes.

Derived from

DebugClientBase.DebugClientBase, AsyncIO

Class Attributes

debugClient

Methods

DebugClientThreads Constructor
attachThread Public method to setup a thread for DebugClient to debug.
eventLoop Public method implementing our event loop.
lockClient Public method to acquire the lock for this client.
setCurrentThread Private method to set the current thread.
set_quit Private method to do a 'set quit' on all threads.
threadTerminated Public method called when a DebugThread has exited.
unlockClient Public method to release the lock for this client.

DebugClientThreads (Constructor)

DebugClientThreads()

Constructor

DebugClientThreads.attachThread

attachThread(target = None, args = None, kwargs = None, mainThread = False)

Public method to setup a thread for DebugClient to debug.

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.

target
the start function of the target thread (i.e. the user code)
args
arguments to pass to target
kwargs
keyword arguments to pass to target
mainThread
True, if we are attaching to the already started mainthread of the app
Returns:
identifier of the created thread

DebugClientThreads.eventLoop

eventLoop(disablePolling = False)

Public method implementing our event loop.

disablePolling
flag indicating to enter an event loop with polling disabled (boolean)

DebugClientThreads.lockClient

lockClient(blocking = True)

Public method to acquire the lock for this client.

blocking
flag to indicating a blocking lock
Returns:
flag indicating successful locking

DebugClientThreads.setCurrentThread

setCurrentThread(id)

Private method to set the current thread.

id
the id the current thread should be set to.

DebugClientThreads.set_quit

set_quit()

Private method to do a 'set quit' on all threads.

DebugClientThreads.threadTerminated

threadTerminated(dbgThread)

Public method called when a DebugThread has exited.

dbgThread
the DebugThread that has exited

DebugClientThreads.unlockClient

unlockClient()

Public method to release the lock for this client.

Up


_debugclient_start_new_thread

_debugclient_start_new_thread(target, args, kwargs = {})

Module function used to allow for debugging of multiple threads.

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 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 DebugThread.py

target
the start function of the target thread (i.e. the user code)
args
arguments to pass to target
kwargs
keyword arguments to pass to target
Returns:
The identifier of the created thread
Up