Fix folly/ThreadLocal with clang after PthreadKeyUnregister change
[folly.git] / folly / Portability.h
index bdac6cc33fe714e24a75baed89d2585940923bad..d0c37d9b5aac56dc014a80d6c6f8a1eda3da3909 100644 (file)
@@ -397,5 +397,14 @@ constexpr size_t constexpr_strlen(const char* s) {
 #endif
 }
 
+#if defined(__APPLE__) || defined(_MSC_VER)
+#define MAX_STATIC_CONSTRUCTOR_PRIORITY
+#else
+// 101 is the highest priority allowed by the init_priority attribute.
+// This priority is already used by JEMalloc and other memory allocators so
+// we will take the next one.
+#define MAX_STATIC_CONSTRUCTOR_PRIORITY __attribute__ ((__init_priority__(102)))
+#endif
+
 } // namespace folly
 #endif // FOLLY_PORTABILITY_H_