proxygen
non_atomic< T > Struct Template Reference

Public Member Functions

 non_atomic ()=default
 
 non_atomic (const non_atomic &)=delete
 
constexpr non_atomic (T desired)
 
T operator+= (T arg)
 
T load (std::memory_order=std::memory_order_seq_cst) const
 
 operator T () const
 
void store (T desired, std::memory_order=std::memory_order_seq_cst)
 
T exchange (T desired, std::memory_order=std::memory_order_seq_cst)
 
bool compare_exchange_weak (T &expected, T desired, std::memory_order=std::memory_order_seq_cst, std::memory_order=std::memory_order_seq_cst)
 
bool compare_exchange_strong (T &expected, T desired, std::memory_order=std::memory_order_seq_cst, std::memory_order=std::memory_order_seq_cst)
 
bool is_lock_free () const
 

Public Attributes

T value
 

Detailed Description

template<class T>
struct non_atomic< T >

Definition at line 33 of file AtomicUnorderedMapTest.cpp.

Constructor & Destructor Documentation

template<class T >
non_atomic< T >::non_atomic ( )
default
template<class T >
non_atomic< T >::non_atomic ( const non_atomic< T > &  )
delete
template<class T >
constexpr non_atomic< T >::non_atomic ( T  desired)
inline

Definition at line 38 of file AtomicUnorderedMapTest.cpp.

38 : value(desired) {}

Member Function Documentation

template<class T >
bool non_atomic< T >::compare_exchange_strong ( T expected,
T  desired,
std::memory_order  = std::memory_order_seq_cst,
std::memory_order  = std::memory_order_seq_cst 
)
inline

Definition at line 82 of file AtomicUnorderedMapTest.cpp.

References folly::value().

86  {
87  if (value == expected) {
88  value = desired;
89  return true;
90  }
91 
92  expected = value;
93  return false;
94  }
template<class T >
bool non_atomic< T >::compare_exchange_weak ( T expected,
T  desired,
std::memory_order  = std::memory_order_seq_cst,
std::memory_order  = std::memory_order_seq_cst 
)
inline

Definition at line 68 of file AtomicUnorderedMapTest.cpp.

References folly::value().

72  {
73  if (value == expected) {
74  value = desired;
75  return true;
76  }
77 
78  expected = value;
79  return false;
80  }
template<class T >
T non_atomic< T >::exchange ( T  desired,
std::memory_order  = std::memory_order_seq_cst 
)
inline

Definition at line 60 of file AtomicUnorderedMapTest.cpp.

References deadlock::load(), and folly::T.

62  {
63  T old = load();
64  store(desired);
65  return old;
66  }
#define T(v)
Definition: http_parser.c:233
T load(std::memory_order=std::memory_order_seq_cst) const
void store(T desired, std::memory_order=std::memory_order_seq_cst)
template<class T >
bool non_atomic< T >::is_lock_free ( ) const
inline

Definition at line 96 of file AtomicUnorderedMapTest.cpp.

References Atom, testing::Key(), value, and testing::Value().

96  {
97  return true;
98  }
template<class T >
T non_atomic< T >::load ( std::memory_order  = std::memory_order_seq_cst) const
inline

Definition at line 45 of file AtomicUnorderedMapTest.cpp.

References folly::value().

45  {
46  return value;
47  }
template<class T >
non_atomic< T >::operator T ( ) const
inline

Definition at line 50 of file AtomicUnorderedMapTest.cpp.

References deadlock::load().

50  {
51  return load();
52  }
T load(std::memory_order=std::memory_order_seq_cst) const
template<class T >
T non_atomic< T >::operator+= ( T  arg)
inline

Definition at line 40 of file AtomicUnorderedMapTest.cpp.

References deadlock::load().

40  {
41  value += arg;
42  return load();
43  }
T load(std::memory_order=std::memory_order_seq_cst) const
template<class T >
void non_atomic< T >::store ( T  desired,
std::memory_order  = std::memory_order_seq_cst 
)
inline

Definition at line 54 of file AtomicUnorderedMapTest.cpp.

56  {
57  value = desired;
58  }

Member Data Documentation

template<class T >
T non_atomic< T >::value

Definition at line 34 of file AtomicUnorderedMapTest.cpp.


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