TaurusFirstRead

- class TaurusFirstRead(*p, **k)[source]
First read manages a list of attributes that have to be read in the same period.
The helper runs a lightweight background thread that consumes an internal queue and performs a one-shot poll for every attribute requested. The thread auto-stops after a period of inactivity and is transparently restarted on demand whenever a new attribute is enqueued.
Import from
taurus.core.taurusfirstreadas:from taurus.core.taurusfirstread import TaurusFirstRead
- addAttribute(attr: TaurusAttribute)[source]
Adds an attribute to the queue for asynchronous reading.
The attribute will be processed by the internal background thread that batches reads occurring within the same polling period. This allows grouping and optimizing communication with devices.
- Parameters:
attr (TaurusAttribute) – Object to be read.
- execute(force_restart: bool = False)[source]
Start the worker thread if needed, optionally forcing a restart.
The worker is restarted on demand when
force_restartis True, clearing the stop flag. If a live worker already exists andforce_restartis False, this is a no-op.
- init()[source]
Initializes the internal state and starts the background reading thread.
This method is intended to be called only once, during the first creation of the singleton instance. It sets up the task queue, control flags, and launches a daemon thread that continuously processes attribute read requests.
It uses an internal _initialized flag to prevent repeated initialization in case the method is accidentally invoked more than once.