Skip to main content

Module current

Module current 

Source
Expand description

The operator the current thread is scheduling.

Timely records the identifier of each operator for the duration of its schedule call, the same identifier that ScheduleEvent reports. Code that runs without a handle to the operator, such as a global allocator attributing allocations, can read it with operator_id.

The identifier names an operator within one worker. Peer workers of a computation build the same dataflows in the same order, so an identifier names the same operator on each of them, but it means nothing beyond that computation. The value assumes one computation is stepped on a thread at a time. A host that steps several workers of unrelated computations on one thread has to tell them apart itself.

Work outside any operator, such as communication in Worker::step and dataflow construction, has no current operator. Work that happens on behalf of an operator outside its schedule call, for example trace maintenance driven by the host application, can claim that operator with enter. Hold the guard in a scoped binding around that work, and never across a call to Worker::step.

Reading and writing the value does not allocate where the platform provides native thread-locals. Elsewhere, the first access on a thread may allocate.

Structs§

Guard
Restores the previously current operator on drop. See enter.

Functions§

enter
Marks id as the operator this thread is scheduling until the returned guard drops.
operator_id
The identifier of the innermost operator this thread is scheduling, if any.