Commit 27045b27 authored by Aaryaman Sagar's avatar Aaryaman Sagar Committed by Facebook Github Bot

Use folly::cacheline_align_v for cache alignment in thread pools

Summary:
Use folly::cacheline_align_v to prevent failures when running folly on platforms
where extended alignment is not supported.  The thread pools only used extended
alignment as an optimization; so it is safe to disable it when not needed

Reviewed By: yfeldblum

Differential Revision: D17077439

fbshipit-source-id: 63ba59aaf7ce45231bb25427af84292c3a3464a9
parent 7cfbc254
...@@ -73,8 +73,7 @@ class IOThreadPoolExecutor : public ThreadPoolExecutor, public IOExecutor { ...@@ -73,8 +73,7 @@ class IOThreadPoolExecutor : public ThreadPoolExecutor, public IOExecutor {
folly::EventBaseManager* getEventBaseManager(); folly::EventBaseManager* getEventBaseManager();
private: private:
struct alignas(hardware_destructive_interference_size) IOThread struct alignas(folly::cacheline_align_v) IOThread : public Thread {
: public Thread {
IOThread(IOThreadPoolExecutor* pool) IOThread(IOThreadPoolExecutor* pool)
: Thread(pool), shouldRun(true), pendingTasks(0) {} : Thread(pool), shouldRun(true), pendingTasks(0) {}
std::atomic<bool> shouldRun; std::atomic<bool> shouldRun;
......
...@@ -167,8 +167,7 @@ class ThreadPoolExecutor : public DefaultKeepAliveExecutor { ...@@ -167,8 +167,7 @@ class ThreadPoolExecutor : public DefaultKeepAliveExecutor {
struct TaskStatsCallbackRegistry; struct TaskStatsCallbackRegistry;
struct alignas(hardware_destructive_interference_size) Thread struct alignas(folly::cacheline_align_v) Thread : public ThreadHandle {
: public ThreadHandle {
explicit Thread(ThreadPoolExecutor* pool) explicit Thread(ThreadPoolExecutor* pool)
: id(nextId++), : id(nextId++),
handle(), handle(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment