make sure stdatomic.h is included when checking for ATOMIC_INT_LOCK_FREE
diff --git a/aten/src/TH/THAllocator.c b/aten/src/TH/THAllocator.c
index 5954949..ea42d11f 100644
--- a/aten/src/TH/THAllocator.c
+++ b/aten/src/TH/THAllocator.c
@@ -1,6 +1,18 @@
#include "THAllocator.h"
#include "THAtomic.h"
+/* needed for ATOMIC_INT_LOCK_FREE */
+/* cannot go in THAtomic.h because of interactions with OpenMP giving
+ sorry not implemented errors */
+#if defined(USE_C11_ATOMICS)
+#include <stdatomic.h>
+#if ATOMIC_INT_LOCK_FREE == 2
+#define TH_ATOMIC_IPC_REFCOUNT 1
+#endif
+#elif defined(USE_MSC_ATOMICS) || defined(USE_GCC_ATOMICS)
+#define TH_ATOMIC_IPC_REFCOUNT 1
+#endif
+
/* stuff for mapped files */
#ifdef _WIN32
#include <windows.h>
diff --git a/aten/src/TH/THAtomic.h b/aten/src/TH/THAtomic.h
index 24c43d3..8431664 100644
--- a/aten/src/TH/THAtomic.h
+++ b/aten/src/TH/THAtomic.h
@@ -115,11 +115,4 @@
*/
TH_API ptrdiff_t THAtomicCompareAndSwapPtrdiff(ptrdiff_t volatile *a, ptrdiff_t oldvalue, ptrdiff_t newvalue);
-#if defined(USE_C11_ATOMICS) && defined(ATOMIC_INT_LOCK_FREE) && \
- ATOMIC_INT_LOCK_FREE == 2
-#define TH_ATOMIC_IPC_REFCOUNT 1
-#elif defined(USE_MSC_ATOMICS) || defined(USE_GCC_ATOMICS)
-#define TH_ATOMIC_IPC_REFCOUNT 1
-#endif
-
#endif