dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
dfx::Runtime::ThreadData Struct Reference

Per-thread runtime metadata associated with a ThreadPool worker. More...

#include <dfx-runtime/ThreadData.hpp>

Public Member Functions

 ThreadData (std::thread::id id)
 Construct thread data for a specific worker thread.

Public Attributes

std::thread::id const tid
 Thread identifier of the owning worker.
uint32_t nestedLevel = 0
 Current inline execution depth.

Detailed Description

Per-thread runtime metadata associated with a ThreadPool worker.

ThreadData stores lightweight, thread-local runtime information for threads managed by the dfx runtime (most notably ThreadPool workers).

An instance of ThreadData is:

  • created automatically when a worker thread starts,
  • destroyed automatically when that worker thread stops.

Access to this structure is mediated by the owning ThreadPool via the threadData() helpers. Threads that do not belong to the pool have no associated ThreadData.

Extensibility
ThreadData is intentionally designed as an extensible runtime container. Additional per-thread metadata (counters, flags, execution context, debugging information, etc.) may be added in the future.

Consumers should therefore:

  • treat this struct as runtime-owned,
  • avoid assuming it will remain minimal,
  • refrain from copying or persisting references beyond the execution scope.
Note
ThreadData is accessed only by its owning thread during execution. External synchronization is not required and must not be assumed.

Constructor & Destructor Documentation

◆ ThreadData()

dfx::Runtime::ThreadData::ThreadData ( std::thread::id id)
inline

Construct thread data for a specific worker thread.

Parameters
idThread identifier of the owning worker.

Member Data Documentation

◆ nestedLevel

uint32_t dfx::Runtime::ThreadData::nestedLevel = 0

Current inline execution depth.

Counts how many inline calls have been performed consecutively by this thread. When this value exceeds a runtime-defined limit, execution should be deferred instead of continuing inline.

This is used to protect the runtime against unbounded recursion in deeply nested or cyclic dataflow graphs:

  • Each inline call increments nestedLevel.
  • When a configurable threshold is reached, further work must be deferred (e.g. scheduled back onto the thread pool) instead of executed inline.

This mechanism prevents stack overflows while preserving fast-path execution for shallow call chains.

◆ tid

std::thread::id const dfx::Runtime::ThreadData::tid

Thread identifier of the owning worker.


The documentation for this struct was generated from the following file: