folly::SequencedExecutor

An executor that sequences tasks whose submissions were sequenced.

Synopsis

Declared in <folly/executors/SequencedExecutor.h>

class SequencedExecutor
    : public virtual Executor

Description

If add(A) and add(B) were sequenced (i.e. add(B) was called after add(A) call had returned to the caller) then execution of A and B will be sequenced (i.e. B() can be called only after A() returns) too.

Base Classes

NameDescription
ExecutorAn Executor accepts units of work with add(), which should be threadsafe.

Type Aliases

NameDescription
KeepAlive Alias for ExecutorKeepAlive, a safe pointer to an Executor.

Member Functions

NameDescription
~SequencedExecutor [destructor] [virtual]Destroys the executor.
add [virtual]Enqueue a function to be executed by this executor. This and all variants must be threadsafe.
addWithPriority [virtual]Enqueue a function with a given priority, where 0 is the medium priority This is up to the implementation to enforce
getNumPriorities [virtual]Returns the number of priority levels this executor supports.

Static Member Functions

NameDescription
getKeepAliveToken getKeepAliveToken overloads
invokeCatchingExns Invokes f, logging and swallowing any exception it throws.

Static Data Members

NameDescription
HI_PRI Highest schedulable priority.
LO_PRI Lowest schedulable priority.
MID_PRI Medium (default) schedulable priority.

Protected Member Functions

NameDescription
keepAliveAcquire [virtual]Acquire a keep alive token. Should return false if keep-alive mechanism is not supported.
keepAliveRelease [virtual]Release a keep alive token previously acquired by keepAliveAcquire(). Will never be called if keepAliveAcquire() returns false.

Protected Static Member Functions

NameDescription
isKeepAliveDummy Returns true if the KeepAlive is constructed from an executor that does not support the keep alive ref-counting functionality
keepAliveAcquire Acquires a keep-alive reference on executor.
keepAliveRelease Releases a keep-alive reference on executor.
makeKeepAlive Makes a counted (non-dummy, non-alias) keep-alive referring to executor.

Non-Member Functions

NameDescription
async_tracing::logFutureViaTrace hook invoked when a Future is rescheduled onto an executor.
async_tracing::logGetGlobalCPUExecutorTrace hook invoked when the global CPU executor is retrieved.
async_tracing::logGetImmutableCPUExecutorTrace hook invoked when the immutable CPU executor is retrieved.
async_tracing::logSemiFutureViaTrace hook invoked when a SemiFuture is rescheduled onto an executor.
async_tracing::logSetGlobalCPUExecutorTrace hook invoked when the global CPU executor is set.

Derived Classes

NameDescription
EventBase Event loop and I/O multiplexer bound to a single thread.
ManualExecutor A ManualExecutor only does work when you turn the crank, by calling run() or indirectly with makeProgress() or waitFor().
ScopedEventBaseThread Helper that runs an EventBase loop on a dedicated std::thread.
SerializedExecutor A sequenced executor that never runs its tasks concurrently.
VirtualEventBase Light-weight view onto an existing EventBase.