# trulens.core.utils.threading

## trulens.core.utils.threading

Threading Utilities.

### Classes

#### Thread

Bases: `Thread`

Thread that wraps target with copy of context and stack.

App components that do not use this thread class might not be properly tracked.

Some libraries are doing something similar so this class may be less and less needed over time but is still needed at least for our own uses of threads.

#### ThreadPoolExecutor

Bases: `ThreadPoolExecutor`

A ThreadPoolExecutor that keeps track of the stack prior to each thread's invocation.

Apps that do not use this thread pool might not be properly tracked.

#### TP

Manager of thread pools.

Singleton.

##### Attributes

###### MAX_THREADS

```python
MAX_THREADS: int = 128
```

Maximum number of threads to run concurrently.

###### DEBUG_TIMEOUT

```python
DEBUG_TIMEOUT: Optional[float] = 600.0
```

How long to wait (seconds) for any task before restarting it.

##### Functions

###### shutdown

```python
shutdown()
```

Shutdown the pools.
