10 #ifndef _LOG4CPP_THREADING_OMNITHREADS_HH 11 #define _LOG4CPP_THREADING_OMNITHREADS_HH 14 #include <omnithread.h> 31 typedef omni_mutex
Mutex;
48 template<
typename T>
class ThreadLocalDataHolder {
53 _key(omni_thread::allocate_key()) {};
62 inline T*
get()
const {
64 ::omni_thread::self()->get_value(
_key));
65 return (holder) ? holder->
data : NULL;
92 ::omni_thread::self()->get_value(
_key));
95 result = holder->
data;
110 ::omni_thread::self()->get_value(
_key));
119 ::omni_thread::self()->set_value(
_key, holder);
124 class Holder :
public omni_thread::value_t {
Holder & operator=(const Holder &other)
static std::string getThreadId()
Return an identifier for the current thread.
boost::mutex Mutex
Dummy type 'int' for Mutex.
boost::mutex::scoped_lock ScopedLock
Dummy type 'int' defintion of ScopedLock;.
T * operator->() const
Obtains the Object held for the current thread.
void reset(T *p=NULL)
Sets a new Object to be held for the current thread.
T * release()
Releases the Object held for the current thread.
T & operator*() const
Obtains the Object held for the current thread.