proxygen
folly::ScheduledExecutor Class Referenceabstract

#include <ScheduledExecutor.h>

Inheritance diagram for folly::ScheduledExecutor:
folly::Executor folly::EventBase folly::ManualExecutor

Public Types

typedef std::chrono::microseconds Duration
 
typedef std::chrono::steady_clock::time_point TimePoint
 

Public Member Functions

 ~ScheduledExecutor () override=default
 
void add (Func) override=0
 
void schedule (Func &&a)
 Alias for add() (for Rx consistency) More...
 
void schedule (Func &&a, Duration const &dur)
 
virtual void scheduleAt (Func &&, TimePoint const &)
 
virtual TimePoint now ()
 Get this executor's notion of time. Must be threadsafe. More...
 
- Public Member Functions inherited from folly::Executor
virtual ~Executor ()
 
virtual void addWithPriority (Func, int8_t priority)
 
virtual uint8_t getNumPriorities () const
 

Additional Inherited Members

- Static Public Member Functions inherited from folly::Executor
template<typename ExecutorT >
static KeepAlive< ExecutorT > getKeepAliveToken (ExecutorT *executor)
 
template<typename ExecutorT >
static KeepAlive< ExecutorT > getKeepAliveToken (ExecutorT &executor)
 
- Static Public Attributes inherited from folly::Executor
static const int8_t LO_PRI = SCHAR_MIN
 
static const int8_t MID_PRI = 0
 
static const int8_t HI_PRI = SCHAR_MAX
 
- Protected Member Functions inherited from folly::Executor
virtual bool keepAliveAcquire ()
 
virtual void keepAliveRelease ()
 
- Static Protected Member Functions inherited from folly::Executor
template<typename ExecutorT >
static bool isKeepAliveDummy (const KeepAlive< ExecutorT > &keepAlive)
 
template<typename ExecutorT >
static KeepAlive< ExecutorT > makeKeepAlive (ExecutorT *executor)
 

Detailed Description

Definition at line 28 of file ScheduledExecutor.h.

Member Typedef Documentation

typedef std::chrono::microseconds folly::ScheduledExecutor::Duration

Definition at line 32 of file ScheduledExecutor.h.

typedef std::chrono::steady_clock::time_point folly::ScheduledExecutor::TimePoint

Definition at line 33 of file ScheduledExecutor.h.

Constructor & Destructor Documentation

folly::ScheduledExecutor::~ScheduledExecutor ( )
overridedefault

Member Function Documentation

void folly::ScheduledExecutor::add ( Func  )
overridepure virtual

Enqueue a function to executed by this executor. This and all variants must be threadsafe.

Implements folly::Executor.

Implemented in folly::EventBase, and folly::ManualExecutor.

Referenced by schedule().

virtual TimePoint folly::ScheduledExecutor::now ( )
inlinevirtual

Get this executor's notion of time. Must be threadsafe.

Reimplemented in folly::ManualExecutor.

Definition at line 57 of file ScheduledExecutor.h.

References now().

Referenced by folly::EventBase::loopBody(), schedule(), folly::EventBase::scheduleAt(), fizz::server::test::TEST(), and TEST().

57  {
59  }
std::chrono::steady_clock::time_point now()
void folly::ScheduledExecutor::schedule ( Func &&  a)
inline

Alias for add() (for Rx consistency)

Definition at line 40 of file ScheduledExecutor.h.

References a, add(), and folly::gen::move.

Referenced by TEST().

40  {
41  add(std::move(a));
42  }
void add(Func) override=0
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
char a
void folly::ScheduledExecutor::schedule ( Func &&  a,
Duration const &  dur 
)
inline

Schedule a Func to be executed after dur time has elapsed Expect millisecond resolution at best.

Definition at line 46 of file ScheduledExecutor.h.

References a, folly::gen::move, now(), and scheduleAt().

46  {
47  scheduleAt(std::move(a), now() + dur);
48  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
virtual TimePoint now()
Get this executor&#39;s notion of time. Must be threadsafe.
char a
virtual void scheduleAt(Func &&, TimePoint const &)
virtual void folly::ScheduledExecutor::scheduleAt ( Func &&  ,
TimePoint const &   
)
inlinevirtual

Schedule a Func to be executed at time t, or as soon afterward as possible. Expect millisecond resolution at best. Must be threadsafe.

Reimplemented in folly::EventBase, and folly::ManualExecutor.

Definition at line 52 of file ScheduledExecutor.h.

Referenced by schedule().

52  {
53  throw_exception<std::logic_error>("unimplemented");
54  }

The documentation for this class was generated from the following file: