proxygen
folly::parking_lot_detail::WaitNodeBase Struct Reference

#include <ParkingLot.h>

Inheritance diagram for folly::parking_lot_detail::WaitNodeBase:
folly::ParkingLot< Data >::WaitNode

Public Member Functions

 WaitNodeBase (uint64_t key, uint64_t lotid)
 
template<typename Clock , typename Duration >
std::cv_status wait (std::chrono::time_point< Clock, Duration > deadline)
 
void wake ()
 
bool signaled ()
 

Public Attributes

const uint64_t key_
 
const uint64_t lotid_
 
WaitNodeBasenext_ {nullptr}
 
WaitNodeBaseprev_ {nullptr}
 
bool signaled_
 
std::mutex mutex_
 
std::condition_variable cond_
 

Detailed Description

Definition at line 33 of file ParkingLot.h.

Constructor & Destructor Documentation

folly::parking_lot_detail::WaitNodeBase::WaitNodeBase ( uint64_t  key,
uint64_t  lotid 
)
inline

Definition at line 44 of file ParkingLot.h.

Member Function Documentation

bool folly::parking_lot_detail::WaitNodeBase::signaled ( )
inline

Definition at line 67 of file ParkingLot.h.

References folly::parking_lot_detail::idallocator, and signaled_.

Referenced by folly::ParkingLot< Data >::park_until().

67  {
68  return signaled_;
69  }
template<typename Clock , typename Duration >
std::cv_status folly::parking_lot_detail::WaitNodeBase::wait ( std::chrono::time_point< Clock, Duration deadline)
inline

Definition at line 48 of file ParkingLot.h.

References max.

Referenced by folly::ParkingLot< Data >::park_until().

48  {
49  std::cv_status status = std::cv_status::no_timeout;
50  std::unique_lock<std::mutex> nodeLock(mutex_);
51  while (!signaled_ && status != std::cv_status::timeout) {
53  status = cond_.wait_until(nodeLock, deadline);
54  } else {
55  cond_.wait(nodeLock);
56  }
57  }
58  return status;
59  }
LogLevel max
Definition: LogLevel.cpp:31
std::condition_variable cond_
Definition: ParkingLot.h:42
void folly::parking_lot_detail::WaitNodeBase::wake ( )
inline

Definition at line 61 of file ParkingLot.h.

61  {
62  std::lock_guard<std::mutex> nodeLock(mutex_);
63  signaled_ = true;
64  cond_.notify_one();
65  }
std::condition_variable cond_
Definition: ParkingLot.h:42

Member Data Documentation

std::condition_variable folly::parking_lot_detail::WaitNodeBase::cond_

Definition at line 42 of file ParkingLot.h.

const uint64_t folly::parking_lot_detail::WaitNodeBase::key_

Definition at line 34 of file ParkingLot.h.

const uint64_t folly::parking_lot_detail::WaitNodeBase::lotid_
std::mutex folly::parking_lot_detail::WaitNodeBase::mutex_

Definition at line 41 of file ParkingLot.h.

WaitNodeBase* folly::parking_lot_detail::WaitNodeBase::next_ {nullptr}
WaitNodeBase* folly::parking_lot_detail::WaitNodeBase::prev_ {nullptr}
bool folly::parking_lot_detail::WaitNodeBase::signaled_

Definition at line 40 of file ParkingLot.h.

Referenced by signaled().


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