struct HashTraits {
size_t operator()(const char* a) {
size_t result = 0;
- while (a[0] != 0) result += static_cast<size_t>(*(a++));
+ while (a[0] != 0) {
+ result += static_cast<size_t>(*(a++));
+ }
return result;
}
size_t operator()(const char& a) {
}
size_t operator()(const StringPiece a) {
size_t result = 0;
- for (const auto& ch : a) result += static_cast<size_t>(ch);
+ for (const auto& ch : a) {
+ result += static_cast<size_t>(ch);
+ }
return result;
}
};
int currentLevel;
do {
currentLevel = insertedLevel.load(std::memory_order_acquire);
- if (currentLevel == kTestEraseInsertions) currentLevel += lag + 1;
+ if (currentLevel == kTestEraseInsertions) {
+ currentLevel += lag + 1;
+ }
} while (currentLevel - lag < i);
KeyT key = randomizeKey(i);
void* atomicHashArrayInsertRaceThread(void* /* j */) {
AHA* arr = atomicHashArrayInsertRaceArray.get();
uintptr_t numInserted = 0;
- while (!runThreadsCreatedAllThreads.load());
+ while (!runThreadsCreatedAllThreads.load()) {
+ ;
+ }
for (int i = 0; i < 2; i++) {
if (arr->insert(RecordT(randomizeKey(i), 0)).first != arr->end()) {
numInserted++;
numOpsPerThread = iters / FLAGS_numThreads;
runThreads([](void* jj) -> void* {
int64_t j = (int64_t) jj;
- while (!runThreadsCreatedAllThreads.load());
+ while (!runThreadsCreatedAllThreads.load()) {
+ ;
+ }
for (int i = 0; i < numOpsPerThread; ++i) {
KeyT key = i + j * numOpsPerThread * 100;
folly::doNotOptimizeAway(globalAHM->find(key) == globalAHM->end());
numOpsPerThread = iters / FLAGS_numThreads;
runThreads([](void* jj) -> void* {
int64_t j = (int64_t) jj;
- while (!runThreadsCreatedAllThreads.load());
+ while (!runThreadsCreatedAllThreads.load()) {
+ ;
+ }
for (int i = 0; i < numOpsPerThread; ++i) {
KeyT key = i + j * numOpsPerThread * 100;
folly::doNotOptimizeAway(globalQPAHM->find(key) == globalQPAHM->end());
numOpsPerThread = iters / FLAGS_numThreads;
runThreads([](void* jj) -> void* {
int64_t j = (int64_t) jj;
- while (!runThreadsCreatedAllThreads.load());
+ while (!runThreadsCreatedAllThreads.load()) {
+ ;
+ }
for (int i = 0; i < numOpsPerThread; ++i) {
if (i % 128) { // ~1% insert mix
KeyT key = randomizeKey(i + j * numOpsPerThread);
numOpsPerThread = iters / FLAGS_numThreads;
runThreads([](void* jj) -> void* {
int64_t j = (int64_t) jj;
- while (!runThreadsCreatedAllThreads.load());
+ while (!runThreadsCreatedAllThreads.load()) {
+ ;
+ }
for (int i = 0; i < numOpsPerThread; ++i) {
if (i % 128) { // ~1% insert mix
KeyT key = randomizeKey(i + j * numOpsPerThread);
numOpsPerThread = iters / FLAGS_numThreads;
runThreads([](void* jj) -> void* {
int64_t j = (int64_t) jj;
- while (!runThreadsCreatedAllThreads.load());
+ while (!runThreadsCreatedAllThreads.load()) {
+ ;
+ }
for (int i = 0; i < numOpsPerThread; ++i) {
KeyT key = randomizeKey(i + j * numOpsPerThread);
folly::doNotOptimizeAway(globalAHA->find(key)->second);
numOpsPerThread = iters / FLAGS_numThreads;
runThreads([](void* jj) -> void* {
int64_t j = (int64_t) jj;
- while (!runThreadsCreatedAllThreads.load());
+ while (!runThreadsCreatedAllThreads.load()) {
+ ;
+ }
for (int i = 0; i < numOpsPerThread; ++i) {
KeyT key = randomizeKey(i + j * numOpsPerThread);
folly::doNotOptimizeAway(globalAHM->find(key)->second);
numOpsPerThread = iters / FLAGS_numThreads;
runThreads([](void* jj) -> void* {
int64_t j = (int64_t) jj;
- while (!runThreadsCreatedAllThreads.load());
+ while (!runThreadsCreatedAllThreads.load()) {
+ ;
+ }
for (int i = 0; i < numOpsPerThread; ++i) {
KeyT key = randomizeKey(i + j * numOpsPerThread);
folly::doNotOptimizeAway(globalQPAHM->find(key)->second);