Manually controlled Timekeeper for unit testing.

Synopsis

Declared in <folly/futures/ManualTimekeeper.h>

class ManualTimekeeper
    : public folly::Timekeeper

Description

We assume advance(), now(), and numScheduled() are called from only a single thread, while after() can safely be called from multiple threads.

Base Classes

Name

Description

folly::Timekeeper

Member Functions

Name

Description

ManualTimekeeper [constructor]

Constructs a ManualTimekeeper with its clock at the epoch.

advance

Advance the timekeeper's clock to (now() + dur). All futures with target time points less than or equal to (now() + dur) are fulfilled after the call to advance() returns

advanceToNext

Advance the timekeeper's clock at least enough to release the next pending event.

after

after overloads

afterUnsafe

Unsafe version of after that returns an inline Future. Any work added to this future will run inline on the Timekeeper's thread. This can potentially cause problems with timing.

at

Returns a future that will complete at the requested time.

atUnsafe

Unsafe version of at that returns an inline Future. Any work added to this future will run inline on the Timekeeper's thread. This can potentially cause problems with timing.

now

Returns the current clock value in the timekeeper. This is advanced only when someone calls advance()

numScheduled

Returns the number of futures that are pending and have not yet been fulfilled

Created with MrDocs