19 #include <boost/thread/tss.hpp>
42 void set(
const T& i) {
63 boost::thread_specific_ptr<T> _val;
73 #if defined(MONGO_HAVE___THREAD) || defined(MONGO_HAVE___DECLSPEC_THREAD)
77 boost::thread_specific_ptr<T> tsp;
90 #if defined(MONGO_HAVE___DECLSPEC_THREAD)
92 #define TSP_DECLARE(T, p) extern TSP<T> p;
94 #define TSP_DEFINE(T, p) \
95 __declspec(thread) T* _##p; \
98 T* TSP<T>::get() const { \
101 void TSP<T>::reset(T* v) { \
107 #define TSP_DECLARE(T, p) \
108 extern __thread T* _##p; \
110 inline T* TSP<T>::get() const { \
115 #define TSP_DEFINE(T, p) \
118 void TSP<T>::reset(T* v) { \
125 #elif defined(_POSIX_THREADS) && (_POSIX_THREADS >= 0)
132 verify(pthread_key_create(&_key, TSP::dodelete) == 0);
136 pthread_key_delete(_key);
139 static void dodelete(
void* x) {
140 T* t =
reinterpret_cast<T*
>(x);
145 return reinterpret_cast<T*
>(pthread_getspecific(_key));
151 verify(pthread_setspecific(_key, v) == 0);
164 #define TSP_DECLARE(T, p) extern TSP<T> p;
166 #define TSP_DEFINE(T, p) TSP<T> p;
172 boost::thread_specific_ptr<T> tsp;
189 #define TSP_DECLARE(T, p) extern TSP<T> p;
191 #define TSP_DEFINE(T, p) TSP<T> p;
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
remove mongo implementation macros after using
macros for mongo internals
Definition: threadlocal.h:31
Definition: threadlocal.h:171