00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _LOG4CPP_THREADING_DUMMYTHREADS_HH
00011 #define _LOG4CPP_THREADING_DUMMYTHREADS_HH
00012
00013 #include <log4cpp/Portability.hh>
00014 #include <stdio.h>
00015 #include <string>
00016
00017 namespace log4cpp {
00018 namespace threading {
00019 static std::string getThreadId() {
00020
00021 return std::string("thread1");
00022 };
00023
00028 typedef int Mutex;
00029
00033 typedef int ScopedLock;
00034
00035 template<typename T> class ThreadLocalDataHolder {
00036 public:
00037 typedef T data_type;
00038
00039 inline ThreadLocalDataHolder() {};
00040 inline ~ThreadLocalDataHolder() {
00041 if (_data)
00042 delete _data;
00043 };
00044
00045 inline T* get() const {
00046 return _data;
00047 };
00048
00049 inline T* operator->() const { return get(); };
00050 inline T& operator*() const { return *get(); };
00051
00052 inline T* release() {
00053 T* result = _data;
00054 _data = NULL;
00055
00056 return result;
00057 };
00058
00059 inline void reset(T* p = NULL) {
00060 if (_data)
00061 delete _data;
00062 _data = p;
00063 };
00064
00065 private:
00066 T* _data;
00067 };
00068 }
00069 }
00070 #endif