Skip to content

Commit

Permalink
Let PriorityUnboundedQueueSet align its queues
Browse files Browse the repository at this point in the history
Summary: [Folly] Let `PriorityUnboundedQueueSet` align its queues, which have extended alignment, even when `std::allocator` does not honor extended alignment.

Reviewed By: magedm

Differential Revision: D19174993

fbshipit-source-id: 0bc0d75c6d239c97b6e1c7380bffff0363008e16
yfeldblum authored and facebook-github-bot committed Dec 20, 2019
1 parent 0d92b69 commit db5458a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion folly/concurrency/PriorityUnboundedQueueSet.h
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
#include <atomic>
#include <vector>

#include <folly/Memory.h>
#include <folly/concurrency/UnboundedQueue.h>
#include <folly/lang/Align.h>

@@ -137,7 +138,12 @@ class PriorityUnboundedQueueSet {
}

private:
std::vector<queue> queues_;
// queue_alloc custom allocator is necessary until C++17
// http://open-std.org/JTC1/SC22/WG21/docs/papers/2012/n3396.htm
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65122
// https://bugs.llvm.org/show_bug.cgi?id=22634
using queue_alloc = AlignedSysAllocator<queue, FixedAlign<alignof(queue)>>;
std::vector<queue, queue_alloc> queues_;
}; // PriorityUnboundedQueueSet

/* Aliases */

0 comments on commit db5458a

Please sign in to comment.