/*
- * Copyright 2017 Facebook, Inc.
+ * Copyright 2017-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
#include <folly/SharedMutex.h>
#include <stdlib.h>
#include <folly/Benchmark.h>
#include <folly/MPMCQueue.h>
-#include <folly/RWSpinLock.h>
#include <folly/portability/GFlags.h>
#include <folly/portability/GTest.h>
+#include <folly/synchronization/RWSpinLock.h>
#include <folly/test/DeterministicSchedule.h>
using namespace folly;
using namespace folly::test;
using namespace std;
-using namespace chrono;
+using namespace std::chrono;
typedef DeterministicSchedule DSched;
typedef SharedMutexImpl<true, void, DeterministicAtomic, true>
EXPECT_FALSE(lock.try_lock_shared(token));
// move ownership to another write holder via assign operator
- typename Lock::WriteHolder holder3;
+ typename Lock::WriteHolder holder3(nullptr);
holder3 = std::move(holder2);
EXPECT_FALSE(lock.try_lock());
EXPECT_FALSE(lock.try_lock_shared(token));
}
TEST(SharedMutex, mixed_mostly_write_read_prio) {
- for (int pass = 0; pass < 5; ++pass) {
+ for (int pass = 0; pass < (folly::kIsSanitizeAddress ? 1 : 5); ++pass) {
runMixed<atomic, SharedMutexReadPriority, TokenLocker>(
50000, 300, 0.9, false);
}
}
TEST(SharedMutex, mixed_mostly_write_write_prio) {
- for (int pass = 0; pass < 5; ++pass) {
+ for (int pass = 0; pass < (folly::kIsSanitizeAddress ? 1 : 5); ++pass) {
runMixed<atomic, SharedMutexWritePriority, TokenLocker>(
50000, 300, 0.9, false);
}
}
TEST(SharedMutex, remote_read_prio) {
- for (int pass = 0; pass < 100; ++pass) {
+ for (int pass = 0; pass < (folly::kIsSanitizeAddress ? 1 : 100); ++pass) {
runRemoteUnlock<SharedMutexReadPriority, atomic>(100000, 0.1, 0.1, 5, 5);
}
}