/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2015 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <atomic>
#include <chrono>
#include <condition_variable>
+#include <limits.h>
#include <map>
#include <mutex>
#include <set>
}
}
+// clang is unable to compile this code unless in c++14 mode.
+#if __cplusplus >= 201402L
+namespace {
+// This will fail to compile unless ThreadLocal{Ptr} has a constexpr
+// default constructor. This ensures that ThreadLocal is safe to use in
+// static constructors without worrying about initialization order
+class ConstexprThreadLocalCompile {
+ ThreadLocal<int> a_;
+ ThreadLocalPtr<int> b_;
+
+ constexpr ConstexprThreadLocalCompile() {}
+};
+}
+#endif
+
// Simple reference implementation using pthread_get_specific
template<typename T>
class PThreadGetSpecific {