folly::VirtualEventBase

Light-weight view onto an existing EventBase.

Synopsis

Declared in <folly/io/async/VirtualEventBase.h>

class VirtualEventBase
    : public folly::TimeoutManager
    , public folly::SequencedExecutor

Base Classes

NameDescription
folly::TimeoutManagerBase interface to be implemented by all classes expecting to manage timeouts. AsyncTimeout will use implementations of this interface to schedule/cancel timeouts.
folly::SequencedExecutorAn executor that sequences tasks whose submissions were sequenced.

Type Aliases

NameDescription
Func Callback type invoked when a timeout fires.
KeepAlive Alias for ExecutorKeepAlive, a safe pointer to an Executor.
timeout_type Millisecond-resolution timeout duration.
timeout_type_high_res Microsecond-resolution timeout duration.

Enums

NameDescription
InternalEnum Distinguishes internal timeouts from normal ones.

Member Functions

NameDescription
VirtualEventBase [constructor]Constructors
~VirtualEventBase [destructor] [virtual]Blocks until all keep-alive tokens are released and tasks complete.
operator= [deleted]Deleted copy assignment.
add add overloads
addWithPriority [virtual]Enqueue a function with a given priority, where 0 is the medium priority This is up to the implementation to enforce
attachTimeoutManager attachTimeoutManager overloads
bumpHandlingTime [virtual]Bumps the handling time of the backing EventBase.
cancelTimeout [virtual]Cancels a scheduled timeout on the backing EventBase.
detachTimeoutManager [virtual]Detaches a timeout from the backing EventBase.
getEventBase Returns the backing EventBase.
getNumPriorities [virtual]Returns the number of priority levels this executor supports.
inRunningEventBaseThread Returns whether the caller runs in the backing EventBase thread.
isInTimeoutManagerThread [virtual]Returns whether the caller runs in the backing EventBase thread.
runAfterDelay Runs the given Cob at some time after the specified number of milliseconds. (No guarantees exactly when.)
runInEventBaseThread VirtualEventBase destructor blocks until all tasks scheduled through its runInEventBaseThread are complete.
runOnDestruction runOnDestruction overloads
scheduleTimeout scheduleTimeout overloads
scheduleTimeoutHighRes [virtual]Schedules AsyncTimeout to fire after timeout microseconds
timer Returns the timer of the backing EventBase.
tryRunAfterDelay Attempts to run the given Cob after the specified delay.

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
clearCobTimeouts Cancels and clears all callback timeouts registered via runAfterDelay.
keepAliveAcquire [virtual]Acquires a keep-alive token on this VirtualEventBase.
keepAliveRelease [virtual]Releases a keep-alive token on this VirtualEventBase.

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.

Friends

NameDescription
folly::EventBaseAn event loop that drives asynchronous I/O and timers.

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.