DummyThreads.hh
Go to the documentation of this file.
1 /*
2  * DummyThreads.hh
3  *
4  * Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
5  * Copyright 2002, Bastiaan Bakker. All rights reserved.
6  *
7  * See the COPYING file for the terms of usage and distribution.
8  */
9 
10 #ifndef _LOG4CPP_THREADING_DUMMYTHREADS_HH
11 #define _LOG4CPP_THREADING_DUMMYTHREADS_HH
12 
13 #include <log4cpp/Portability.hh>
14 #include <stdio.h>
15 #include <string>
16 
17 namespace log4cpp {
18  namespace threading {
19  std::string getThreadId();
28  char* getThreadId(char* buffer);
29 
34  typedef int Mutex;
35 
39  typedef int ScopedLock;
40 
41  template<typename T> class ThreadLocalDataHolder {
42  public:
43  typedef T data_type;
44 
45  inline ThreadLocalDataHolder() {};
47  if (_data)
48  delete _data;
49  };
50 
51  inline T* get() const {
52  return _data;
53  };
54 
55  inline T* operator->() const { return get(); };
56  inline T& operator*() const { return *get(); };
57 
58  inline T* release() {
59  T* result = _data;
60  _data = NULL;
61 
62  return result;
63  };
64 
65  inline void reset(T* p = NULL) {
66  if (_data)
67  delete _data;
68  _data = p;
69  };
70 
71  private:
72  T* _data;
73  };
74  }
75 }
76 #endif
static std::string getThreadId()
Definition: BoostThreads.hh:22
boost::mutex Mutex
Definition: BoostThreads.hh:37
boost::mutex::scoped_lock ScopedLock
Definition: BoostThreads.hh:40


log4cpp
Author(s): Stephen Roderick, Bastiaan Bakker, Cedric Le Goater, Steve Ostlind, Marcel Harkema, Walter Stroebel, Glenn Scott and Tony Cheung
autogenerated on Sun Jun 23 2019 19:10:00