proxygen
|
#include <TimeoutManager.h>
Classes | |
struct | CobTimeouts |
Public Types | |
enum | InternalEnum { InternalEnum::INTERNAL, InternalEnum::NORMAL } |
typedef std::chrono::milliseconds | timeout_type |
using | Func = folly::Function< void()> |
Public Member Functions | |
TimeoutManager () | |
virtual | ~TimeoutManager () |
virtual void | attachTimeoutManager (AsyncTimeout *obj, InternalEnum internal)=0 |
virtual void | detachTimeoutManager (AsyncTimeout *obj)=0 |
virtual bool | scheduleTimeout (AsyncTimeout *obj, timeout_type timeout)=0 |
virtual void | cancelTimeout (AsyncTimeout *obj)=0 |
virtual void | bumpHandlingTime ()=0 |
virtual bool | isInTimeoutManagerThread ()=0 |
void | runAfterDelay (Func cob, uint32_t milliseconds, InternalEnum internal=InternalEnum::NORMAL) |
bool | tryRunAfterDelay (Func cob, uint32_t milliseconds, InternalEnum internal=InternalEnum::NORMAL) |
Protected Member Functions | |
void | clearCobTimeouts () |
Private Attributes | |
std::unique_ptr< CobTimeouts > | cobTimeouts_ |
Base interface to be implemented by all classes expecting to manage timeouts. AsyncTimeout will use implementations of this interface to schedule/cancel timeouts.
Definition at line 33 of file TimeoutManager.h.
using folly::TimeoutManager::Func = folly::Function<void()> |
Definition at line 36 of file TimeoutManager.h.
typedef std::chrono::milliseconds folly::TimeoutManager::timeout_type |
Definition at line 35 of file TimeoutManager.h.
|
strong |
folly::TimeoutManager::TimeoutManager | ( | ) |
Definition at line 70 of file TimeoutManager.cpp.
|
virtual |
|
pure virtual |
Attaches/detaches TimeoutManager to AsyncTimeout
Implemented in folly::EventBase, and folly::VirtualEventBase.
Referenced by folly::AsyncTimeout::AsyncTimeout(), and folly::AsyncTimeout::attachTimeoutManager().
|
pure virtual |
This is used to mark the beginning of a new loop cycle by the first handler fired within that cycle.
Implemented in folly::EventBase, and folly::VirtualEventBase.
Referenced by folly::AsyncTimeout::libeventCallback().
|
pure virtual |
Cancels the AsyncTimeout, if scheduled
Implemented in folly::EventBase, and folly::VirtualEventBase.
Referenced by folly::AsyncTimeout::cancelTimeout().
|
protected |
Definition at line 100 of file TimeoutManager.cpp.
References cobTimeouts_, and folly::detail::timeout.
Referenced by folly::VirtualEventBase::destroyImpl(), folly::EventBase::~EventBase(), and ~TimeoutManager().
|
pure virtual |
Implemented in folly::EventBase, and folly::VirtualEventBase.
Referenced by folly::AsyncTimeout::detachTimeoutManager().
|
pure virtual |
Helper method to know whether we are running in the timeout manager thread
Implemented in folly::EventBase, and folly::VirtualEventBase.
Referenced by folly::AsyncTimeout::attachTimeoutManager().
void folly::TimeoutManager::runAfterDelay | ( | Func | cob, |
uint32_t | milliseconds, | ||
InternalEnum | internal = InternalEnum::NORMAL |
||
) |
Runs the given Cob at some time after the specified number of milliseconds. (No guarantees exactly when.)
Throws a std::system_error if an error occurs.
Definition at line 73 of file TimeoutManager.cpp.
References folly::gen::move, folly::throwSystemError(), and tryRunAfterDelay().
Referenced by TEST().
|
pure virtual |
Schedules AsyncTimeout to fire after timeout
milliseconds
Implemented in folly::EventBase, and folly::VirtualEventBase.
Referenced by folly::AsyncTimeout::scheduleTimeout().
bool folly::TimeoutManager::tryRunAfterDelay | ( | Func | cob, |
uint32_t | milliseconds, | ||
InternalEnum | internal = InternalEnum::NORMAL |
||
) |
Definition at line 83 of file TimeoutManager.cpp.
References cobTimeouts_, folly::gen::move, and folly::detail::timeout.
Referenced by folly::HandshakeTimeoutCallback::connAccepted(), folly::TestSSLAsyncCacheServer::getSessionCallback(), TestClientPipelineFactory::newPipeline(), runAfterDelay(), scheduleEvents(), TEST(), and folly::fibers::EventBaseLoopController::timedSchedule().
|
private |
Definition at line 99 of file TimeoutManager.h.
Referenced by clearCobTimeouts(), and tryRunAfterDelay().