|
| ParkingLot () |
|
template<typename Key , typename D , typename ToPark , typename PreWait > |
ParkResult | park (const Key key, D &&data, ToPark &&toPark, PreWait &&preWait) |
|
template<typename Key , typename D , typename ToPark , typename PreWait , typename Clock , typename Duration > |
ParkResult | park_until (const Key key, D &&data, ToPark &&toPark, PreWait &&preWait, std::chrono::time_point< Clock, Duration > deadline) |
|
template<typename Key , typename D , typename ToPark , typename PreWait , typename Rep , typename Period > |
ParkResult | park_for (const Key key, D &&data, ToPark &&toPark, PreWait &&preWait, std::chrono::duration< Rep, Period > &timeout) |
|
template<typename Key , typename Unparker > |
void | unpark (const Key key, Unparker &&func) |
|
template<typename Key , typename Func > |
void | unpark (const Key bits, Func &&func) |
|
template<typename Data = Unit>
class folly::ParkingLot< Data >
Definition at line 162 of file ParkingLot.h.
template<typename Data = Unit>
template<typename Key , typename D , typename ToPark , typename PreWait >
Definition at line 189 of file ParkingLot.h.
References D, folly::data(), testing::Key(), and max.
Referenced by folly::detail::atomic_notification::atomic_wait_impl(), BENCHMARK_RELATIVE(), TEST(), and WaitableMutex::wait().
192 std::forward<D>(
data),
193 std::forward<ToPark>(toPark),
194 std::forward<PreWait>(preWait),
constexpr auto data(C &c) -> decltype(c.data())
ParkResult park_until(const Key key, D &&data, ToPark &&toPark, PreWait &&preWait, std::chrono::time_point< Clock, Duration > deadline)
template<typename Data = Unit>
template<typename Key , typename D , typename ToPark , typename PreWait , typename Rep , typename Period >
ParkResult folly::ParkingLot< Data >::park_for |
( |
const Key |
key, |
|
|
D && |
data, |
|
|
ToPark && |
toPark, |
|
|
PreWait && |
preWait, |
|
|
std::chrono::duration< Rep, Period > & |
timeout |
|
) |
| |
|
inline |
Definition at line 219 of file ParkingLot.h.
References D, folly::data(), testing::Key(), and now().
227 std::forward<D>(
data),
228 std::forward<ToPark>(toPark),
229 std::forward<PreWait>(preWait),
std::chrono::steady_clock::time_point now()
constexpr auto data(C &c) -> decltype(c.data())
ParkResult park_until(const Key key, D &&data, ToPark &&toPark, PreWait &&preWait, std::chrono::time_point< Clock, Duration > deadline)
template<typename Data >
template<typename Key , typename D , typename ToPark , typename PreWait , typename Clock , typename Duration >
Definition at line 256 of file ParkingLot.h.
References folly::parking_lot_detail::Bucket::bucketFor(), folly::data(), folly::parking_lot_detail::WaitNodeBase::lotid_, folly::parking_lot_detail::WaitNodeBase::signaled(), folly::Skip, folly::Timeout, folly::hash::twang_mix64(), uint64_t, folly::Unpark, and folly::parking_lot_detail::WaitNodeBase::wait().
Referenced by folly::detail::atomic_notification::atomic_wait_until_impl().
264 WaitNode node(key,
lotid_, std::forward<D>(
data));
268 bucket.count_.fetch_add(1, std::memory_order_seq_cst);
270 std::unique_lock<std::mutex> bucketLock(bucket.mutex_);
272 if (!std::forward<ToPark>(toPark)()) {
274 bucket.count_.fetch_sub(1, std::memory_order_relaxed);
278 bucket.push_back(&node);
281 std::forward<PreWait>(preWait)();
283 auto status = node.wait(deadline);
285 if (status == std::cv_status::timeout) {
287 std::lock_guard<std::mutex> bucketLock(bucket.mutex_);
288 if (!node.signaled()) {
constexpr auto data(C &c) -> decltype(c.data())
uint64_t twang_mix64(uint64_t key) noexcept
static Bucket & bucketFor(uint64_t key)