# eric3.Debugger.DebugClientThreads

Module implementing the multithreaded Qt version of the debug client.

### 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 Qt debugger client by subclassing all relevant base classes.

### Derived from

DebugClientBase.DebugClientBase, AsyncIOBase

### Methods

DebugClientThreads | Constructor
attachThread | Public method to setup a thread for DebugClient to debug.
eventLoop | Private 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=0)

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.

args
  arguments to pass to target
kwargs
  keyword arguments to pass to target
mainThread
  non-zero, if we are attaching to the already started mainthread of the app
target
  the start function of the target thread (i.e. the user code)

Returns:
  The identifier of the created thread

### DebugClientThreads.eventLoop

eventLoop()

Private method implementing our event loop.

### DebugClientThreads.lockClient

lockClient(blocking=1)

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 only performed, if we are really debugging and not just running the script. See DebugClientThreads.attachThread and DebugThread.DebugThread in DebugThread.py

args
  arguments to pass to target
kwargs
  keyword arguments to pass to target
target
  the start function of the target thread (i.e. the user code)

Returns:
  The identifier of the created thread

Up