- void reset(T* new_value=0) {
- T * old_value = get();
- set(new_value);
- if (old_value) {
- delete old_value;
- }
- }
-
- T* release (void) {
- T * old_value = get();
- set(0);
- return old_value;
- }
-
-private:
- void set(T* new_value) {
-#ifdef _WIN32
- TlsSetValue(dwTlsIndex, new_value);
-#else
- pthread_setspecific(key, new_value);
-#endif
- }
- };
-
-
- /**
- * Same interface as std::thread
- */
- class thread {
- public:
-#ifdef _WIN32
- typedef HANDLE native_handle_type;
-#else
- typedef pthread_t native_handle_type;
-#endif
-