folly::TimedDrivableExecutor

A DrivableExecutor can be driven via its drive() method or its driveUntil() that drives until some time point.

Synopsis

Declared in <folly/executors/TimedDrivableExecutor.h>

class TimedDrivableExecutor
    : public DrivableExecutor

Base Classes

NameDescription
DrivableExecutorAn executor that can be driven forward via its drive() method.

Type Aliases

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

Member Functions

NameDescription
TimedDrivableExecutor [constructor]Construct an empty executor.
~TimedDrivableExecutor [destructor] [virtual]Destroy the executor.
add [virtual]Enqueue a function to be run when the executor is driven.
addWithPriority [virtual]Enqueue a function with a given priority, where 0 is the medium priority This is up to the implementation to enforce
drain Do work until there is no more work to do. Returns the number of functions that were executed (maybe 0). Unlike run, this method is not stable. It will chase an infinite tail of work so should be used with care. There will be no work available to perform at the moment that this returns.
drive [virtual]Implements DrivableExecutor
getNumPriorities [virtual]Returns the number of priority levels this executor supports.
run Do work. Returns the number of functions that were executed (maybe 0). Non-blocking, in the sense that we don't wait for work (we can't control whether one of the functions blocks). This is stable, it will not chase an ever-increasing tail of work. This also means, there may be more work available to perform at the moment that this returns.
try_drive Make progress if there is work to do and return true. Otherwise return false.
try_drive_for Make progress on this Executor's work. Acts as drive, except it will only wait for a period of timeout for work to be enqueued. If no work is enqueued by that point, it will return.
try_drive_until Make progress on this Executor's work. Acts as drive, except it will only wait until deadline for work to be enqueued. If no work is enqueued by that point, it will return.
try_wait Return true if there is work to do, false otherwise
try_wait_for Wait for work to do or for a period of timeout, whichever is sooner.
try_wait_until Wait for work to do or until deadline passes, whichever is sooner.
wait Wait for work to do.

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.