proxygen
folly::fibers::Baton::TimeoutHandler Class Reference

#include <Baton.h>

Public Member Functions

void scheduleTimeout (TimeoutController::Duration timeoutMs)
 

Private Member Functions

void cancelTimeout ()
 

Private Attributes

std::function< void()> timeoutFunc_ {nullptr}
 
FiberManagerfiberManager_ {nullptr}
 
intptr_t timeoutPtr_ {0}
 

Friends

class Baton
 

Detailed Description

Provides a way to schedule a wakeup for a wait()ing fiber. A TimeoutHandler must be passed to Baton::wait(TimeoutHandler&) before a timeout is scheduled. It is only safe to use the TimeoutHandler on the same thread as the wait()ing fiber. scheduleTimeout() may only be called once prior to the end of the associated Baton's life.

Definition at line 218 of file Baton.h.

Member Function Documentation

void folly::fibers::Baton::TimeoutHandler::cancelTimeout ( )
private

Definition at line 204 of file Baton.cpp.

Referenced by folly::fibers::Baton::wait().

204  {
205  if (timeoutPtr_) {
207  }
208 }
std::shared_ptr< TimeoutController > timeoutManager_
void folly::fibers::Baton::TimeoutHandler::scheduleTimeout ( TimeoutController::Duration  timeoutMs)

Definition at line 192 of file Baton.cpp.

Referenced by TEST().

193  {
194  assert(fiberManager_ != nullptr);
195  assert(timeoutFunc_ != nullptr);
196  assert(timeoutPtr_ == 0);
197 
198  if (timeout.count() > 0) {
199  timeoutPtr_ =
200  fiberManager_->timeoutManager_->registerTimeout(timeoutFunc_, timeout);
201  }
202 }
std::function< void()> timeoutFunc_
Definition: Baton.h:227
std::shared_ptr< TimeoutController > timeoutManager_

Friends And Related Function Documentation

friend class Baton
friend

Definition at line 223 of file Baton.h.

Member Data Documentation

FiberManager* folly::fibers::Baton::TimeoutHandler::fiberManager_ {nullptr}
private

Definition at line 228 of file Baton.h.

Referenced by folly::fibers::Baton::wait().

std::function<void()> folly::fibers::Baton::TimeoutHandler::timeoutFunc_ {nullptr}
private

Definition at line 227 of file Baton.h.

Referenced by folly::fibers::Baton::wait().

intptr_t folly::fibers::Baton::TimeoutHandler::timeoutPtr_ {0}
private

Definition at line 230 of file Baton.h.

Referenced by folly::fibers::Baton::wait().


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