Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions blockingconcurrentqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@

#pragma once

// Work around potential conflict with system headers (e.g., <linux/fs.h>) that define BLOCK_SIZE as a macro
#ifdef BLOCK_SIZE
#pragma push_macro("BLOCK_SIZE")
#undef BLOCK_SIZE
#define CONCURRENTQUEUE_BLOCK_SIZE_WAS_DEFINED
#endif

#include "concurrentqueue.h"
#include "lightweightsemaphore.h"

Expand Down Expand Up @@ -580,3 +587,9 @@ inline void swap(BlockingConcurrentQueue<T, Traits>& a, BlockingConcurrentQueue<
}

} // end namespace moodycamel

// Restore BLOCK_SIZE macro if it was defined before
#ifdef CONCURRENTQUEUE_BLOCK_SIZE_WAS_DEFINED
#pragma pop_macro("BLOCK_SIZE")
#undef CONCURRENTQUEUE_BLOCK_SIZE_WAS_DEFINED
#endif
13 changes: 13 additions & 0 deletions concurrentqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
#pragma warning(disable: 4127) // conditional expression is constant
#endif

// Work around potential conflict with system headers (e.g., <linux/fs.h>) that define BLOCK_SIZE as a macro
#ifdef BLOCK_SIZE
#pragma push_macro("BLOCK_SIZE")
#undef BLOCK_SIZE
#define CONCURRENTQUEUE_BLOCK_SIZE_WAS_DEFINED
#endif

#if defined(__APPLE__)
#include "TargetConditionals.h"
#endif
Expand Down Expand Up @@ -3738,6 +3745,12 @@ inline void swap(typename ConcurrentQueue<T, Traits>::ImplicitProducerKVP& a, ty

}

// Restore BLOCK_SIZE macro if it was defined before
#ifdef CONCURRENTQUEUE_BLOCK_SIZE_WAS_DEFINED
#pragma pop_macro("BLOCK_SIZE")
#undef CONCURRENTQUEUE_BLOCK_SIZE_WAS_DEFINED
#endif

#if defined(_MSC_VER) && (!defined(_HAS_CXX17) || !_HAS_CXX17)
#pragma warning(pop)
#endif
Expand Down