/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <folly/RWSpinLock.h>
#include <stdlib.h>
-#include <vector>
#include <thread>
+#include <vector>
#include <glog/logging.h>
static std::atomic<bool> stopThread;
using namespace folly;
-template<typename RWSpinLockT> struct RWSpinLockTest: public testing::Test {
+template <typename RWSpinLockT> struct RWSpinLockTest: public testing::Test {
typedef RWSpinLockT RWSpinLockType;
};
TYPED_TEST_CASE(RWSpinLockTest, Implementations);
-template<typename RWSpinLockType>
+template <typename RWSpinLockType>
static void run(RWSpinLockType* lock) {
int64_t reads = 0;
int64_t writes = 0;
sleep(5);
stop.store(true, std::memory_order_release);
- for (auto& t : threads) t.join();
+ for (auto& t : threads) {
+ t.join();
+ }
LOG(INFO) << "reads: " << reads.load(std::memory_order_acquire)
<< "; writes: " << writes.load(std::memory_order_acquire)