24 using namespace folly;
33 void setValue(
unsigned char value) {
34 for (
auto& item : contents) {
39 void checkValue(
unsigned char value) {
40 for (
auto& item : contents) {
45 void checkValue2(
unsigned char value1,
unsigned char value2) {
46 for (
auto& item : contents) {
53 unsigned char contents[99];
57 TEST(TearableTest, BasicOperations) {
61 for (
char c = 0;
c < 10; ++
c) {
69 TEST(TearableTest, Races) {
70 std::atomic<bool>
stop(
false);
72 std::thread write1([&]() {
74 while (!
stop.load(std::memory_order_relaxed)) {
75 tearable.
store(data0);
78 std::thread write2([&]() {
80 while (!
stop.load(std::memory_order_relaxed)) {
81 tearable.
store(data1);
85 for (
int i = 0;
i < 100 * 1000; ++
i) {
87 val.checkValue2(1, 2);
89 stop.store(
true, std::memory_order_relaxed);
#define ASSERT_EQ(val1, val2)
—— Concurrent Priority Queue Implementation ——
std::is_trivially_copyable< T > is_trivially_copyable
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
#define ASSERT_TRUE(condition)
TEST(SequencedExecutor, CPUThreadPoolExecutor)