Table of Contents

Interface IPacedJob

Namespace
Hi.Common
Assembly
HiGeom.dll

A unit of work the player thread runs at a pace point in resumable chunks (TryRunAtPacePoint(IPacedJob, CancellationToken, out Task, bool)). The player drives it: one chunk, then the pass gate — Pause() parks the job there, Resume() goes on, a stop opens the gate so the next chunk sees the run's CancellationToken and can finish — then the next chunk, until the job reports that no chunk remains. The play does not advance while a job is in flight. A chunk must not park on its own account; it may observe the run's token and finish early, and it may throw OperationCanceledException to end as cancelled. When the player itself fails between two chunks, or on the auto-resume before the first chunk, it tells the job so through Abandon(Exception) before the job's task faults.

public interface IPacedJob
Extension Methods

Methods

Abandon(Exception)

Told by the player, on the player thread, that the player itself failed between two chunks — or before the first one, on the auto-resume of a paused run — and drives no further chunk: the job is over. The job releases what it holds and settles its own result; its task then faults with reason, an OperationCanceledException included (a handler's cancellation is the player failing, not the job cancelling). Not called when the job's own chunk threw (the job knows). The default does nothing.

void Abandon(Exception reason)

Parameters

reason Exception

What the player threw between the chunks.

TryRunNextChunk(PacePlayee)

Runs the next chunk on the player thread.

bool TryRunNextChunk(PacePlayee playee)

Parameters

playee PacePlayee

The playee of the live run; its player carries the run's cancellation token.

Returns

bool

True when a further chunk remains; false when the job is done (completed, cancelled or refused).