DummyThreads.hh
Go to the documentation of this file.
00001 /*
00002  * DummyThreads.hh
00003  *
00004  * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
00005  * Copyright 2002, Bastiaan Bakker. All rights reserved.
00006  *
00007  * See the COPYING file for the terms of usage and distribution.
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         std::string getThreadId();
00028             char* getThreadId(char* buffer);
00029 
00034         typedef int Mutex;
00035 
00039         typedef int ScopedLock;
00040 
00041         template<typename T> class ThreadLocalDataHolder {
00042             public:
00043             typedef T data_type;
00044 
00045             inline ThreadLocalDataHolder() {};
00046             inline ~ThreadLocalDataHolder() {
00047                 if (_data) 
00048                     delete _data;
00049             };
00050             
00051             inline T* get() const {
00052                 return _data;
00053             };
00054 
00055             inline T* operator->() const { return get(); };
00056             inline T& operator*() const { return *get(); };
00057 
00058             inline T* release() {
00059                 T* result = _data;
00060                 _data = NULL;
00061 
00062                 return result;
00063             };
00064 
00065             inline void reset(T* p = NULL) {
00066                 if (_data) 
00067                     delete _data;
00068                 _data = p;
00069             };
00070 
00071             private:            
00072             T* _data;            
00073         };
00074     }
00075 }
00076 #endif


log4cpp
Author(s): Stephen Roderick, Bastiaan Bakker, Cedric Le Goater, Steve Ostlind, Marcel Harkema, Walter Stroebel, Glenn Scott and Tony Cheung
autogenerated on Sun Aug 14 2016 03:18:26