Skip to content

WorkerThread

QuantConnect.Util.WorkerThread

WorkerThread()

Bases: Object, IDisposable

This worker tread is required to guarantee all python operations are executed by the same thread, to enable complete debugging functionality. We don't use the main thread, to avoid any chance of blocking the process

Creates a new instance, which internally launches a new worker thread

This codeEntityType is protected.

instance

instance: WorkerThread = ...

The worker thread instance

finished_work_item

finished_work_item: AutoResetEvent

Will be set when the worker thread finishes a work item

add

add(action: Callable[[], Any]) -> None

Adds a new item of work

Parameters:

Name Type Description Default
action Callable[[], Any]

The work item to add

required

dispose

dispose() -> None

Disposes the worker thread.