OnDemandWorkerFunc

Run a job in a fiber, making sure never to run two simultaneously.

This semantics is useful for deferred jobs that need to collect or parse a state that changes. The number of jobs is not dependent on the number of state changes.

The usage is to trigger the worker when the state changes. If no job is currently running, a fiber is immediately launched to carry out the job. If the job is already running, it will trigger again once the current instance finishes.

Constructors

this
this(ParameterTypeTuple!F args, SpawnFiberDlg spawnFiberDlg)

Construct a worker

this
this(SpawnFiberDlg spawnFiberDlg)
Undocumented in source.
this
this(ParameterTypeTuple!F args, FiberGroup* group)

Construct a worker

Postblit

this(this)
this(this)
Undocumented in source.

Members

Functions

DEBUG
void DEBUG(Args args)

Helper for more verbose DEBUG logging

cancel
void cancel(bool currentOnly)

Cancel currently running tasks.

disable
void disable()

Disable the worker from receiving new jobs.

enable
void enable()

Enable a disabled worker.

run
void run()
void run(ParameterTypeTuple!F args)

Trigger an execution of the worker.

waitComplete
void waitComplete(Timeout timeout)

Wait for all currently pending tasks to complete

waitIdle
void waitIdle(Timeout timeout)

Wait for task queue to empty.

Properties

spawned
bool spawned [@property getter]

Reports whether a fiber is currently handling a request

Meta