19 #include <condition_variable> 48 : value(value_), counter(counter_) {
53 assert(counter.load() > 0);
64 completeBaton_.wait();
72 completeBaton_.post();
84 std::atomic<int> cnt1{0};
85 ptr.
reset(std::make_unique<TestObject>(1, cnt1));
89 std::atomic<int> cnt2{0};
90 ptr.
reset(std::make_unique<TestObject>(2, cnt2));
100 std::atomic<int> cnt2{0};
109 std::atomic<int> cnt1{0};
110 ptr.
reset(std::make_unique<TestObject>(1, cnt1));
116 ptr.
reset(std::make_unique<TestObject>(2, cnt2));
135 std::atomic<int> cnt{0};
175 ptr.
reset(std::make_unique<TestObject>(1, cnt));
178 ptr.
reset(std::make_unique<TestObject>(2, cnt));
182 ptr.
reset(std::make_unique<TestObject>(3, cnt));
183 ptr.
reset(std::make_unique<TestObject>(4, cnt));
186 ptr.
reset(std::make_unique<TestObject>(5, cnt));
200 std::atomic<int> cnt1{0};
211 std::atomic<int> cnt1{0};
212 std::atomic<int> cnt2{0};
217 ptr.
reset(std::make_unique<TestObject>(1, cnt1));
232 ptr.
reset(std::make_unique<TestObject>(2, cnt2));
245 DCHECK_EQ(count_.load(), 0);
261 return count_.load();
268 template <
typename Container>
274 std::atomic<int64_t> count_{1};
folly::Baton requestBaton_
ReadMostlySharedPtr< T, RefCount > getShared() const
static void useGlobal(const Container &)
int64_t operator--() noexcept
std::atomic< int > & counter
#define EXPECT_EQ(val1, val2)
constexpr detail::Map< Move > move
std::shared_ptr< T > getStdShared() const
requires E e noexcept(noexcept(s.error(std::move(e))))
TEST_F(ReadMostlySharedPtrTest, BasicStores)
ReadMostlySharedPtrTest()
folly::Baton completeBaton_
const unsigned int TEST_TIMEOUT
TestObject(int value_, std::atomic< int > &counter_)
void add(ReadMostlyMainPtr< T, RefCount > ptr) noexcept
int64_t operator*() noexcept
#define EXPECT_TRUE(condition)
std::atomic< int > counter
int64_t operator++() noexcept
#define EXPECT_NE(val1, val2)
folly::detail::CompressionCounter * counter_
#define EXPECT_FALSE(condition)