Loading...
Searching...
No Matches
DummyThreads.hh
Go to the documentation of this file.
/*
* DummyThreads.hh
*
* Copyright 2002, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
* Copyright 2002, Bastiaan Bakker. All rights reserved.
*
* See the COPYING file for the terms of usage and distribution.
*/
#ifndef _LOG4SHIB_THREADING_DUMMYTHREADS_HH
#define _LOG4SHIB_THREADING_DUMMYTHREADS_HH
#include <log4shib/Portability.hh>
#include <stdio.h>
#include <string>
namespace log4shib {
namespace threading {
std::string getThreadId();
typedef int Mutex;
typedef int ScopedLock;
template<typename T> class ThreadLocalDataHolder {
public:
typedef T data_type;
inline ThreadLocalDataHolder() {};
inline ~ThreadLocalDataHolder() {
if (_data)
delete _data;
};
inline T* get() const {
return _data;
};
inline T* operator->() const { return get(); };
inline T& operator*() const { return *get(); };
inline T* release() {
T* result = _data;
_data = NULL;
return result;
};
inline void reset(T* p = NULL) {
if (_data)
delete _data;
_data = p;
};
private:
T* _data;
};
}
}
#endif
Portability.hh
log4shib::threading::Mutex
Definition PThreads.hh:29
log4shib::threading::ScopedLock
definition of ScopedLock;
Definition PThreads.hh:58
log4shib::threading::ThreadLocalDataHolder
This class holds Thread local data of type T, i.e.
Definition BoostThreads.hh:32
log4shib::threading::ThreadLocalDataHolder::operator->
T * operator->() const
Definition DummyThreads.hh:46
log4shib::threading::ThreadLocalDataHolder::operator*
T & operator*() const
Definition DummyThreads.hh:47
log4shib::threading::ThreadLocalDataHolder::~ThreadLocalDataHolder
~ThreadLocalDataHolder()
Definition DummyThreads.hh:37
log4shib::threading::ThreadLocalDataHolder::reset
void reset(T *p=NULL)
Definition DummyThreads.hh:56
log4shib::threading::ThreadLocalDataHolder::get
T * get() const
Definition DummyThreads.hh:42
log4shib::threading::ThreadLocalDataHolder::data_type
T data_type
Definition DummyThreads.hh:34
log4shib::threading::ThreadLocalDataHolder::release
T * release()
Definition DummyThreads.hh:49
log4shib::threading::ThreadLocalDataHolder::ThreadLocalDataHolder
ThreadLocalDataHolder()
Definition DummyThreads.hh:36
log4shib::threading
Definition BoostThreads.hh:21
log4shib::threading::getThreadId
static std::string getThreadId()
Return an identifier for the current thread.
Definition BoostThreads.hh:22
log4shib
The top level namespace for all 'Log for C++' types and classes.
Definition AbortAppender.hh:16