/usr/include/log4cpp/threading/BoostThreads.hh is in liblog4cpp5-dev 1.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | /*
* BoostThreads.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 _LOG4CPP_THREADING_BOOSTTHREADS_HH
#define _LOG4CPP_THREADING_BOOSTTHREADS_HH
#include <log4cpp/Portability.hh>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/tss.hpp>
#include <cstdio>
#include <string>
namespace log4cpp {
namespace threading {
static std::string getThreadId() {
char buffer[14];
// Boost.Threads stores the thread ID but doesn't expose it
sprintf(buffer, "not available");
return std::string(buffer);
};
typedef boost::mutex Mutex;
typedef boost::mutex::scoped_lock ScopedLock;
template<typename T> class ThreadLocalDataHolder {
public:
inline T* get() const {
return _localData.get();
};
inline T* operator->() const { return _localData.get(); };
inline T& operator*() const { return *_localData.get(); };
inline T* release() {
return _localData.release();
};
inline void reset(T* p = NULL) {
_localData.reset(p);
};
private:
boost::thread_specific_ptr<T> _localData;
};
}
}
#endif
|