Skip to content

Commit

Permalink
Use cacheline_aligned in LifoSem
Browse files Browse the repository at this point in the history
Summary: [Folly] Use simpler `cacheline_aligned` v.s. `CachelinePadded` in `LifoSem`, per comments atop `CachelinePadded`.

Reviewed By: aary

Differential Revision: D18166262

fbshipit-source-id: 807c668666fbbc9c16d5f449fa20234e56b29042
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Oct 28, 2019
1 parent c321eb5 commit f4fb426
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions folly/synchronization/LifoSem.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
#include <system_error>

#include <folly/CPortability.h>
#include <folly/CachelinePadded.h>
#include <folly/IndexedMemPool.h>
#include <folly/Likely.h>
#include <folly/Portability.h>
#include <folly/Traits.h>
#include <folly/detail/StaticSingletonManager.h>
#include <folly/lang/Aligned.h>
#include <folly/lang/SafeAssert.h>
#include <folly/synchronization/AtomicStruct.h>
#include <folly/synchronization/SaturatingSemaphore.h>
Expand Down Expand Up @@ -367,7 +367,7 @@ template <typename Handoff, template <typename> class Atom = std::atomic>
struct LifoSemBase {
/// Constructor
constexpr explicit LifoSemBase(uint32_t initialValue = 0)
: head_(LifoSemHead::fresh(initialValue)) {}
: head_(in_place, LifoSemHead::fresh(initialValue)) {}

LifoSemBase(LifoSemBase const&) = delete;
LifoSemBase& operator=(LifoSemBase const&) = delete;
Expand Down Expand Up @@ -656,7 +656,7 @@ struct LifoSemBase {
}

private:
CachelinePadded<folly::AtomicStruct<LifoSemHead, Atom>> head_;
cacheline_aligned<folly::AtomicStruct<LifoSemHead, Atom>> head_;

static LifoSemNode<Handoff, Atom>& idxToNode(uint32_t idx) {
auto raw = &LifoSemRawNode<Atom>::pool()[idx];
Expand Down

0 comments on commit f4fb426

Please sign in to comment.