proxygen
folly::detail::distributed_mutex::DistributedMutex< Atomic, TimePublishing >::DistributedMutexStateProxy< Atomic, TimePublishing > Class Template Reference

#include <DistributedMutex-inl.h>

Public Member Functions

 DistributedMutexStateProxy (DistributedMutexStateProxy &&other)
 
 operator bool () const
 
 DistributedMutexStateProxy (CachelinePadded< Waiter< Atomic >> *next, std::uintptr_t expected, bool timedWaiter=false, WakerMetadata wakerMetadata={}, CachelinePadded< Waiter< Atomic >> *waiters=nullptr, CachelinePadded< Waiter< Atomic >> *ready=nullptr)
 

Public Attributes

CachelinePadded< Waiter< Atomic > > * next_ {nullptr}
 
std::uintptr_t expected_ {0}
 
bool timedWaiters_ {false}
 
WakerMetadata wakerMetadata_ {}
 
CachelinePadded< Waiter< Atomic > > * waiters_ {nullptr}
 
CachelinePadded< Waiter< Atomic > > * ready_ {nullptr}
 

Friends

class DistributedMutex< Atomic, TimePublishing >
 

Detailed Description

template<template< typename > class Atomic = std::atomic, bool TimePublishing = true>
template<template< typename > class Atomic, bool TimePublishing>
class folly::detail::distributed_mutex::DistributedMutex< Atomic, TimePublishing >::DistributedMutexStateProxy< Atomic, TimePublishing >

Definition at line 229 of file DistributedMutex-inl.h.

Constructor & Destructor Documentation

template<template< typename > class Atomic = std::atomic, bool TimePublishing = true>
template<template< typename > class Atomic, bool TimePublishing>
folly::detail::distributed_mutex::DistributedMutex< Atomic, TimePublishing >::DistributedMutexStateProxy< Atomic, TimePublishing >::DistributedMutexStateProxy ( DistributedMutexStateProxy< Atomic, TimePublishing > &&  other)
inline

DistributedMutexStateProxy is movable, so the caller can contain their critical section by moving the proxy around

Definition at line 233 of file DistributedMutex-inl.h.

References folly::exchange().

234  : next_{exchange(other.next_, nullptr)},
235  expected_{exchange(other.expected_, 0)},
236  wakerMetadata_{exchange(other.wakerMetadata_, {})},
237  waiters_{exchange(other.waiters_, nullptr)},
238  ready_{exchange(other.ready_, nullptr)} {}
T exchange(T &obj, U &&new_value)
Definition: Utility.h:120
template<template< typename > class Atomic = std::atomic, bool TimePublishing = true>
template<template< typename > class Atomic, bool TimePublishing>
folly::detail::distributed_mutex::DistributedMutex< Atomic, TimePublishing >::DistributedMutexStateProxy< Atomic, TimePublishing >::DistributedMutexStateProxy ( CachelinePadded< Waiter< Atomic >> *  next,
std::uintptr_t  expected,
bool  timedWaiter = false,
WakerMetadata  wakerMetadata = {},
CachelinePadded< Waiter< Atomic >> *  waiters = nullptr,
CachelinePadded< Waiter< Atomic >> *  ready = nullptr 
)
inline

Definition at line 251 of file DistributedMutex-inl.h.

References cpp.ast::next().

255  {},
256  CachelinePadded<Waiter<Atomic>>* waiters = nullptr,
257  CachelinePadded<Waiter<Atomic>>* ready = nullptr)
258  : next_{next},
259  expected_{expected},
260  timedWaiters_{timedWaiter},
261  wakerMetadata_{wakerMetadata},
262  waiters_{waiters},
263  ready_{ready} {}
def next(obj)
Definition: ast.py:58

Member Function Documentation

template<template< typename > class Atomic = std::atomic, bool TimePublishing = true>
template<template< typename > class Atomic, bool TimePublishing>
folly::detail::distributed_mutex::DistributedMutex< Atomic, TimePublishing >::DistributedMutexStateProxy< Atomic, TimePublishing >::operator bool ( ) const
inlineexplicit

The proxy is valid when a mutex acquisition attempt was successful, lock() is guaranteed to return a valid proxy, try_lock() is not

Definition at line 242 of file DistributedMutex-inl.h.

Friends And Related Function Documentation

template<template< typename > class Atomic = std::atomic, bool TimePublishing = true>
template<template< typename > class Atomic, bool TimePublishing>
friend class DistributedMutex< Atomic, TimePublishing >
friend

friend the mutex class, since that will be accessing state private to this class

Definition at line 249 of file DistributedMutex-inl.h.

Member Data Documentation

template<template< typename > class Atomic = std::atomic, bool TimePublishing = true>
template<template< typename > class Atomic, bool TimePublishing>
std::uintptr_t folly::detail::distributed_mutex::DistributedMutex< Atomic, TimePublishing >::DistributedMutexStateProxy< Atomic, TimePublishing >::expected_ {0}
template<template< typename > class Atomic = std::atomic, bool TimePublishing = true>
template<template< typename > class Atomic, bool TimePublishing>
CachelinePadded<Waiter<Atomic> >* folly::detail::distributed_mutex::DistributedMutex< Atomic, TimePublishing >::DistributedMutexStateProxy< Atomic, TimePublishing >::next_ {nullptr}
template<template< typename > class Atomic = std::atomic, bool TimePublishing = true>
template<template< typename > class Atomic, bool TimePublishing>
CachelinePadded<Waiter<Atomic> >* folly::detail::distributed_mutex::DistributedMutex< Atomic, TimePublishing >::DistributedMutexStateProxy< Atomic, TimePublishing >::ready_ {nullptr}
template<template< typename > class Atomic = std::atomic, bool TimePublishing = true>
template<template< typename > class Atomic, bool TimePublishing>
bool folly::detail::distributed_mutex::DistributedMutex< Atomic, TimePublishing >::DistributedMutexStateProxy< Atomic, TimePublishing >::timedWaiters_ {false}
template<template< typename > class Atomic = std::atomic, bool TimePublishing = true>
template<template< typename > class Atomic, bool TimePublishing>
CachelinePadded<Waiter<Atomic> >* folly::detail::distributed_mutex::DistributedMutex< Atomic, TimePublishing >::DistributedMutexStateProxy< Atomic, TimePublishing >::waiters_ {nullptr}
template<template< typename > class Atomic = std::atomic, bool TimePublishing = true>
template<template< typename > class Atomic, bool TimePublishing>
WakerMetadata folly::detail::distributed_mutex::DistributedMutex< Atomic, TimePublishing >::DistributedMutexStateProxy< Atomic, TimePublishing >::wakerMetadata_ {}

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