diff --git a/src/ThreadPool.h b/src/ThreadPool.h index 70d7b6b..0c41ad0 100644 --- a/src/ThreadPool.h +++ b/src/ThreadPool.h @@ -10,9 +10,13 @@ #include #include +#include #include #include #include +// Disable optional cache-line over-alignment so ordinary C++11 new suffices. +// TODO: Benchmark whether restoring it materially improves prefetch throughput. +#define MOODYCAMEL_MAYBE_ALIGN_TO_CACHELINE #include #include @@ -206,3 +210,6 @@ class ThreadPoolWithEnqueueFast : public ThreadPool { ThreadPool::Barrier(); } }; + +static_assert(alignof(ThreadPoolWithEnqueueFast) <= alignof(std::max_align_t), + "Thread pool must support ordinary allocation");