BoostThreads.hh
Go to the documentation of this file.
00001 /*
00002  * BoostThreads.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_BOOSTTHREADS_HH
00011 #define _LOG4CPP_THREADING_BOOSTTHREADS_HH
00012 
00013 #include <log4cpp/Portability.hh>
00014 #include <boost/thread/thread.hpp>
00015 #include <boost/thread/mutex.hpp>
00016 #include <boost/thread/tss.hpp>
00017 #include <cstdio>
00018 #include <string>
00019 
00020 LOG4CPP_NS_BEGIN
00021 namespace threading {
00022     static std::string getThreadId() {
00023         char buffer[14];
00024         // Boost.Threads stores the thread ID but doesn't expose it
00025         sprintf(buffer, "not available");
00026         return std::string(buffer);
00027     };
00028 
00029     typedef boost::mutex Mutex;
00030     typedef boost::mutex::scoped_lock ScopedLock;
00031 
00032     template<typename T> class ThreadLocalDataHolder {
00033     public:
00034         inline T* get() const {
00035             return _localData.get();
00036         };
00037 
00038         inline T* operator->() const { return _localData.get(); };
00039         inline T& operator*() const { return *_localData.get(); };
00040 
00041         inline T* release() {
00042             return _localData.release();
00043         };
00044 
00045         inline void reset(T* p = NULL) {
00046             _localData.reset(p);
00047         };
00048 
00049     private:
00050         boost::thread_specific_ptr<T> _localData;
00051     };
00052 
00053 }
00054 LOG4CPP_NS_END
00055 
00056 #endif


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 18:42:46