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

Name

Description

folly::TimeoutManager

Base interface to be implemented by all classes expecting to manage timeouts. AsyncTimeout will use implementations of this interface to schedule/cancel timeouts.

folly::SequencedExecutor

An executor that sequences tasks whose submissions were sequenced.

Type Aliases

Name

Description

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

Name

Description

InternalEnum

Distinguishes internal timeouts from normal ones.

Member Functions

Name

Description

VirtualEventBase [constructor]

Constructors

~VirtualEventBase [destructor] [virtual]

Blocks until all keep‐alive tokens are released and tasks complete.

operator= [deleted]

Deleted copy assignment.

add [virtual]

Runs the given function in the EventBase thread.

addWithPriority [virtual]

Enqueue a function with a given priority, where 0 is the medium priority This is up to the implementation to enforce

attachTimeoutManager [virtual]

Attaches a timeout to the backing EventBase.

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 [virtual]

Schedules a timeout on the backing EventBase.

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

Name

Description

getKeepAliveToken

getKeepAliveToken overloads

invokeCatchingExns

Invokes f, logging and swallowing any exception it throws.

Static Data Members

Name

Description

HI_PRI

Highest schedulable priority.

LO_PRI

Lowest schedulable priority.

MID_PRI

Medium (default) schedulable priority.

Protected Member Functions

Name

Description

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

Name

Description

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

Name

Description

folly::EventBase

An event loop that drives asynchronous I/O and timers.

Non-Member Functions

Name

Description

async_tracing::logFutureVia

Trace hook invoked when a Future is rescheduled onto an executor.

async_tracing::logGetGlobalCPUExecutor

Trace hook invoked when the global CPU executor is retrieved.

async_tracing::logGetImmutableCPUExecutor

Trace hook invoked when the immutable CPU executor is retrieved.

async_tracing::logSemiFutureVia

Trace hook invoked when a SemiFuture is rescheduled onto an executor.

async_tracing::logSetGlobalCPUExecutor

Trace hook invoked when the global CPU executor is set.

Created with MrDocs