Skip to content

Commit

Permalink
Fixed indentation following pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron314 committed Jan 30, 2020
1 parent e68850f commit 79cec4c
Showing 1 changed file with 41 additions and 37 deletions.
78 changes: 41 additions & 37 deletions concurrentqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -3039,7 +3039,7 @@ class ConcurrentQueue
return create<Block>();
}
else {
return nullptr;
return nullptr;
}
}

Expand Down Expand Up @@ -3269,52 +3269,56 @@ class ConcurrentQueue

inline void populate_initial_implicit_producer_hash()
{
MOODYCAMEL_CONSTEXPR_IF (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) return;
else {
implicitProducerHashCount.store(0, std::memory_order_relaxed);
auto hash = &initialImplicitProducerHash;
hash->capacity = INITIAL_IMPLICIT_PRODUCER_HASH_SIZE;
hash->entries = &initialImplicitProducerHashEntries[0];
for (size_t i = 0; i != INITIAL_IMPLICIT_PRODUCER_HASH_SIZE; ++i) {
initialImplicitProducerHashEntries[i].key.store(details::invalid_thread_id, std::memory_order_relaxed);
MOODYCAMEL_CONSTEXPR_IF (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) {
return;
}
hash->prev = nullptr;
implicitProducerHash.store(hash, std::memory_order_relaxed);
else {
implicitProducerHashCount.store(0, std::memory_order_relaxed);
auto hash = &initialImplicitProducerHash;
hash->capacity = INITIAL_IMPLICIT_PRODUCER_HASH_SIZE;
hash->entries = &initialImplicitProducerHashEntries[0];
for (size_t i = 0; i != INITIAL_IMPLICIT_PRODUCER_HASH_SIZE; ++i) {
initialImplicitProducerHashEntries[i].key.store(details::invalid_thread_id, std::memory_order_relaxed);
}
hash->prev = nullptr;
implicitProducerHash.store(hash, std::memory_order_relaxed);
}
}

void swap_implicit_producer_hashes(ConcurrentQueue& other)
{
MOODYCAMEL_CONSTEXPR_IF (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) return;
else {
// Swap (assumes our implicit producer hash is initialized)
initialImplicitProducerHashEntries.swap(other.initialImplicitProducerHashEntries);
initialImplicitProducerHash.entries = &initialImplicitProducerHashEntries[0];
other.initialImplicitProducerHash.entries = &other.initialImplicitProducerHashEntries[0];

details::swap_relaxed(implicitProducerHashCount, other.implicitProducerHashCount);

details::swap_relaxed(implicitProducerHash, other.implicitProducerHash);
if (implicitProducerHash.load(std::memory_order_relaxed) == &other.initialImplicitProducerHash) {
implicitProducerHash.store(&initialImplicitProducerHash, std::memory_order_relaxed);
MOODYCAMEL_CONSTEXPR_IF (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE == 0) {
return;
}
else {
ImplicitProducerHash* hash;
for (hash = implicitProducerHash.load(std::memory_order_relaxed); hash->prev != &other.initialImplicitProducerHash; hash = hash->prev) {
continue;
// Swap (assumes our implicit producer hash is initialized)
initialImplicitProducerHashEntries.swap(other.initialImplicitProducerHashEntries);
initialImplicitProducerHash.entries = &initialImplicitProducerHashEntries[0];
other.initialImplicitProducerHash.entries = &other.initialImplicitProducerHashEntries[0];

details::swap_relaxed(implicitProducerHashCount, other.implicitProducerHashCount);

details::swap_relaxed(implicitProducerHash, other.implicitProducerHash);
if (implicitProducerHash.load(std::memory_order_relaxed) == &other.initialImplicitProducerHash) {
implicitProducerHash.store(&initialImplicitProducerHash, std::memory_order_relaxed);
}
hash->prev = &initialImplicitProducerHash;
}
if (other.implicitProducerHash.load(std::memory_order_relaxed) == &initialImplicitProducerHash) {
other.implicitProducerHash.store(&other.initialImplicitProducerHash, std::memory_order_relaxed);
}
else {
ImplicitProducerHash* hash;
for (hash = other.implicitProducerHash.load(std::memory_order_relaxed); hash->prev != &initialImplicitProducerHash; hash = hash->prev) {
continue;
else {
ImplicitProducerHash* hash;
for (hash = implicitProducerHash.load(std::memory_order_relaxed); hash->prev != &other.initialImplicitProducerHash; hash = hash->prev) {
continue;
}
hash->prev = &initialImplicitProducerHash;
}
if (other.implicitProducerHash.load(std::memory_order_relaxed) == &initialImplicitProducerHash) {
other.implicitProducerHash.store(&other.initialImplicitProducerHash, std::memory_order_relaxed);
}
else {
ImplicitProducerHash* hash;
for (hash = other.implicitProducerHash.load(std::memory_order_relaxed); hash->prev != &initialImplicitProducerHash; hash = hash->prev) {
continue;
}
hash->prev = &other.initialImplicitProducerHash;
}
hash->prev = &other.initialImplicitProducerHash;
}
}
}

Expand Down

0 comments on commit 79cec4c

Please sign in to comment.