diff options
author | Jonathan Clark <jon.h.clark@gmail.com> | 2011-03-24 09:51:40 -0400 |
---|---|---|
committer | Jonathan Clark <jon.h.clark@gmail.com> | 2011-03-24 09:51:40 -0400 |
commit | eb33700d1c868662b5d0abedaaf3fa47948a89d0 (patch) | |
tree | ed70be84820d243524bab0b59a84b8da033a9c41 /utils | |
parent | ba4f147f84aa0d4623da640a2d0de7e6242a53af (diff) | |
parent | a580faa8177331cf51138a2208e276b703470934 (diff) |
Undo some silly local changes so we can pull
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/static_utoa.h | 2 | ||||
-rw-r--r-- | utils/tdict.cc | 1 | ||||
-rwxr-xr-x | utils/threadlocal.h | 71 |
3 files changed, 1 insertions, 73 deletions
diff --git a/utils/static_utoa.h b/utils/static_utoa.h index d15ed35b..bb3d821f 100755 --- a/utils/static_utoa.h +++ b/utils/static_utoa.h @@ -7,7 +7,7 @@ namespace { static const int utoa_bufsize=40; // 64bit safe. static const int utoa_bufsizem1=utoa_bufsize-1; // 64bit safe. -THREADLOCAL char utoa_buf[utoa_bufsize]; // to put end of string character at buf[20] +static char utoa_buf[utoa_bufsize]; // to put end of string character at buf[20] } inline char *static_utoa(unsigned n) { diff --git a/utils/tdict.cc b/utils/tdict.cc index 23a298f8..c21b2b48 100644 --- a/utils/tdict.cc +++ b/utils/tdict.cc @@ -8,7 +8,6 @@ #include "dict.h" #include "tdict.h" #include "stringlib.h" -#include "threadlocal.h" using namespace std; diff --git a/utils/threadlocal.h b/utils/threadlocal.h deleted file mode 100755 index d79f5d9d..00000000 --- a/utils/threadlocal.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef THREADLOCAL_H -#define THREADLOCAL_H - -#ifndef SETLOCAL_SWAP -# define SETLOCAL_SWAP 0 -#endif - -#ifdef BOOST_NO_MT - -# define THREADLOCAL - -#else - -#ifdef _MSC_VER - -//FIXME: doesn't work with DLLs ... use TLS apis instead (http://www.boost.org/libs/thread/doc/tss.html) -# define THREADLOCAL __declspec(thread) - -#else - -# define THREADLOCAL __thread - -#endif - -#endif - -#include <algorithm> //swap - -// naturally, the below are only thread-safe if value is THREADLOCAL -template <class D> -struct SaveLocal { - D &value; - D old_value; - SaveLocal(D& val) : value(val), old_value(val) {} - ~SaveLocal() { -#if SETLOCAL_SWAP - swap(value,old_value); -#else - value=old_value; -#endif - } -}; - -template <class D> -struct SetLocal { - D &value; - D old_value; - SetLocal(D& val,const D &new_value) : value(val), old_value( -#if SETLOCAL_SWAP - new_value -#else - val -#endif - ) { -#if SETLOCAL_SWAP - swap(value,old_value); -#else - value=new_value; -#endif - } - ~SetLocal() { -#if SETLOCAL_SWAP - swap(value,old_value); -#else - value=old_value; -#endif - } -}; - - -#endif |