Build fix for Solaris.

This commit is contained in:
Gunnar Beutner 2012-08-13 13:06:43 +02:00
parent 1e0bb5d51c
commit c5c534b55b
13 changed files with 41 additions and 42 deletions

View File

@ -23,7 +23,7 @@ using namespace icinga;
vector<Event> Event::m_Events;
condition_variable Event::m_EventAvailable;
mutex Event::m_Mutex;
boost::mutex Event::m_Mutex;
Event::Event(const Event::Callback& callback)
: m_Callback(callback)
@ -34,7 +34,7 @@ void Event::ProcessEvents(const system_time& wait_until)
vector<Event> events;
{
mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
while (m_Events.empty()) {
if (!m_EventAvailable.timed_wait(lock, wait_until))
@ -69,7 +69,7 @@ void Event::Post(const Event::Callback& callback)
Event ev(callback);
{
mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
m_Events.push_back(ev);
m_EventAvailable.notify_all();
}

View File

@ -38,7 +38,7 @@ private:
static vector<Event> m_Events;
static condition_variable m_EventAvailable;
static mutex m_Mutex;
static boost::mutex m_Mutex;
};
}

View File

@ -137,7 +137,6 @@ using boost::static_pointer_cast;
using boost::function;
using boost::thread;
using boost::thread_group;
using boost::mutex;
using boost::condition_variable;
using boost::system_time;
using boost::tie;

View File

@ -21,7 +21,7 @@
using namespace icinga;
mutex Object::m_Mutex;
boost::mutex Object::m_Mutex;
vector<Object::Ptr> Object::m_HeldObjects;
#ifdef _DEBUG
set<Object *> Object::m_AliveObjects;
@ -33,7 +33,7 @@ set<Object *> Object::m_AliveObjects;
Object::Object(void)
{
#ifdef _DEBUG
mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
m_AliveObjects.insert(this);
#endif /* _DEBUG */
}
@ -44,7 +44,7 @@ Object::Object(void)
Object::~Object(void)
{
#ifdef _DEBUG
mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
m_AliveObjects.erase(this);
#endif /* _DEBUG */
}
@ -56,7 +56,7 @@ Object::~Object(void)
*/
void Object::Hold(void)
{
mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
m_HeldObjects.push_back(GetSelf());
}
@ -65,7 +65,7 @@ void Object::Hold(void)
*/
void Object::ClearHeldObjects(void)
{
mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
m_HeldObjects.clear();
}
@ -77,7 +77,7 @@ Object::SharedPtrHolder Object::GetSelf(void)
#ifdef _DEBUG
int Object::GetAliveObjects(void)
{
mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
return m_AliveObjects.size();
}
@ -88,7 +88,7 @@ void Object::PrintMemoryProfile(void)
ofstream dictfp("dictionaries.dump.tmp");
{
mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
set<Object *>::iterator it;
BOOST_FOREACH(Object *obj, m_AliveObjects) {
pair<map<String, int>::iterator, bool> tt;

View File

@ -88,7 +88,7 @@ private:
Object(const Object& other);
Object& operator=(const Object& rhs);
static mutex m_Mutex;
static boost::mutex m_Mutex;
static vector<Object::Ptr> m_HeldObjects;
#ifdef _DEBUG
static set<Object *> m_AliveObjects;

View File

@ -43,14 +43,14 @@ Process::Process(const String& command)
void Process::Run(void)
{
mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
m_Tasks.push_back(GetSelf());
m_TasksCV.notify_all();
}
void Process::WorkerThreadProc(void)
{
mutex::scoped_lock lock(m_Mutex);
boost::mutex::scoped_lock lock(m_Mutex);
map<int, Process::Ptr> tasks;

View File

@ -33,7 +33,7 @@ Socket::Socket(void)
*/
Socket::~Socket(void)
{
mutex::scoped_lock lock(m_SocketMutex);
boost::mutex::scoped_lock lock(m_SocketMutex);
CloseInternal(true);
}
@ -90,7 +90,7 @@ SOCKET Socket::GetFD(void) const
*/
void Socket::Close(void)
{
mutex::scoped_lock lock(m_SocketMutex);
boost::mutex::scoped_lock lock(m_SocketMutex);
CloseInternal(false);
}
@ -209,7 +209,7 @@ String Socket::GetAddressFromSockaddr(sockaddr *address, socklen_t len)
*/
String Socket::GetClientAddress(void)
{
mutex::scoped_lock lock(m_SocketMutex);
boost::mutex::scoped_lock lock(m_SocketMutex);
sockaddr_storage sin;
socklen_t len = sizeof(sin);
@ -227,7 +227,7 @@ String Socket::GetClientAddress(void)
*/
String Socket::GetPeerAddress(void)
{
mutex::scoped_lock lock(m_SocketMutex);
boost::mutex::scoped_lock lock(m_SocketMutex);
sockaddr_storage sin;
socklen_t len = sizeof(sin);
@ -258,7 +258,7 @@ SocketException::SocketException(const String& message, int errorCode)
void Socket::ReadThreadProc(void)
{
mutex::scoped_lock lock(m_SocketMutex);
boost::mutex::scoped_lock lock(m_SocketMutex);
for (;;) {
fd_set readfds, exceptfds;
@ -312,7 +312,7 @@ void Socket::ReadThreadProc(void)
void Socket::WriteThreadProc(void)
{
mutex::scoped_lock lock(m_SocketMutex);
boost::mutex::scoped_lock lock(m_SocketMutex);
for (;;) {
fd_set writefds;

View File

@ -68,7 +68,7 @@ protected:
virtual void CloseInternal(bool from_dtor);
mutable mutex m_SocketMutex;
mutable boost::mutex m_SocketMutex;
private:
SOCKET m_FD; /**< The socket descriptor. */

View File

@ -115,7 +115,7 @@ void TcpClient::HandleWritable(void)
for (;;) {
{
mutex::scoped_lock lock(m_QueueMutex);
boost::mutex::scoped_lock lock(m_QueueMutex);
count = m_SendQueue->GetAvailableBytes();
@ -134,7 +134,7 @@ void TcpClient::HandleWritable(void)
throw_exception(SocketException("send() failed", GetError()));
{
mutex::scoped_lock lock(m_QueueMutex);
boost::mutex::scoped_lock lock(m_QueueMutex);
m_SendQueue->Read(NULL, rc);
}
}
@ -145,7 +145,7 @@ void TcpClient::HandleWritable(void)
*/
size_t TcpClient::GetAvailableBytes(void) const
{
mutex::scoped_lock lock(m_QueueMutex);
boost::mutex::scoped_lock lock(m_QueueMutex);
return m_RecvQueue->GetAvailableBytes();
}
@ -155,7 +155,7 @@ size_t TcpClient::GetAvailableBytes(void) const
*/
void TcpClient::Peek(void *buffer, size_t count)
{
mutex::scoped_lock lock(m_QueueMutex);
boost::mutex::scoped_lock lock(m_QueueMutex);
m_RecvQueue->Peek(buffer, count);
}
@ -165,7 +165,7 @@ void TcpClient::Peek(void *buffer, size_t count)
*/
void TcpClient::Read(void *buffer, size_t count)
{
mutex::scoped_lock lock(m_QueueMutex);
boost::mutex::scoped_lock lock(m_QueueMutex);
m_RecvQueue->Read(buffer, count);
}
@ -175,7 +175,7 @@ void TcpClient::Read(void *buffer, size_t count)
*/
void TcpClient::Write(const void *buffer, size_t count)
{
mutex::scoped_lock lock(m_QueueMutex);
boost::mutex::scoped_lock lock(m_QueueMutex);
m_SendQueue->Write(buffer, count);
}
@ -202,7 +202,7 @@ void TcpClient::HandleReadable(void)
throw_exception(SocketException("recv() failed", GetError()));
{
mutex::scoped_lock lock(m_QueueMutex);
boost::mutex::scoped_lock lock(m_QueueMutex);
m_RecvQueue->Write(data, rc);
}
@ -229,7 +229,7 @@ bool TcpClient::WantsToRead(void) const
bool TcpClient::WantsToWrite(void) const
{
{
mutex::scoped_lock lock(m_QueueMutex);
boost::mutex::scoped_lock lock(m_QueueMutex);
if (m_SendQueue->GetAvailableBytes() > 0)
return true;

View File

@ -68,7 +68,7 @@ protected:
virtual void HandleReadable(void);
virtual void HandleWritable(void);
mutable mutex m_QueueMutex;
mutable boost::mutex m_QueueMutex;
FIFO::Ptr m_SendQueue;
FIFO::Ptr m_RecvQueue;

View File

@ -31,7 +31,7 @@ ThreadPool::ThreadPool(long numThreads)
ThreadPool::~ThreadPool(void)
{
{
mutex::scoped_lock lock(m_Lock);
boost::mutex::scoped_lock lock(m_Lock);
m_Tasks.clear();
@ -46,7 +46,7 @@ ThreadPool::~ThreadPool(void)
void ThreadPool::EnqueueTasks(list<ThreadPoolTask::Ptr>& tasks)
{
{
mutex::scoped_lock lock(m_Lock);
boost::mutex::scoped_lock lock(m_Lock);
m_Tasks.splice(m_Tasks.end(), tasks, tasks.begin(), tasks.end());
}
@ -56,7 +56,7 @@ void ThreadPool::EnqueueTasks(list<ThreadPoolTask::Ptr>& tasks)
void ThreadPool::EnqueueTask(const ThreadPoolTask::Ptr& task)
{
{
mutex::scoped_lock lock(m_Lock);
boost::mutex::scoped_lock lock(m_Lock);
m_Tasks.push_back(task);
}
@ -66,7 +66,7 @@ void ThreadPool::EnqueueTask(const ThreadPoolTask::Ptr& task)
ThreadPoolTask::Ptr ThreadPool::DequeueTask(void)
{
mutex::scoped_lock lock(m_Lock);
boost::mutex::scoped_lock lock(m_Lock);
while (m_Tasks.empty()) {
if (!m_Alive)
@ -83,7 +83,7 @@ ThreadPoolTask::Ptr ThreadPool::DequeueTask(void)
void ThreadPool::WaitForTasks(void)
{
mutex::scoped_lock lock(m_Lock);
boost::mutex::scoped_lock lock(m_Lock);
/* wait for all pending tasks */
while (!m_Tasks.empty())

View File

@ -47,7 +47,7 @@ public:
void WaitForTasks(void);
private:
mutable mutex m_Lock;
mutable boost::mutex m_Lock;
condition_variable m_CV;
list<ThreadPoolTask::Ptr> m_Tasks;

View File

@ -80,7 +80,7 @@ void TlsClient::Start(void)
*/
shared_ptr<X509> TlsClient::GetClientCertificate(void) const
{
mutex::scoped_lock lock(m_SocketMutex);
boost::mutex::scoped_lock lock(m_SocketMutex);
return shared_ptr<X509>(SSL_get_certificate(m_SSL.get()), &Utility::NullDeleter);
}
@ -92,7 +92,7 @@ shared_ptr<X509> TlsClient::GetClientCertificate(void) const
*/
shared_ptr<X509> TlsClient::GetPeerCertificate(void) const
{
mutex::scoped_lock lock(m_SocketMutex);
boost::mutex::scoped_lock lock(m_SocketMutex);
return shared_ptr<X509>(SSL_get_peer_certificate(m_SSL.get()), X509_free);
}
@ -137,7 +137,7 @@ void TlsClient::HandleReadable(void)
}
if (IsConnected()) {
mutex::scoped_lock lock(m_QueueMutex);
boost::mutex::scoped_lock lock(m_QueueMutex);
m_RecvQueue->Write(data, rc);
}
@ -163,7 +163,7 @@ void TlsClient::HandleWritable(void)
if (IsConnected()) {
{
mutex::scoped_lock lock(m_QueueMutex);
boost::mutex::scoped_lock lock(m_QueueMutex);
count = m_SendQueue->GetAvailableBytes();
@ -203,7 +203,7 @@ void TlsClient::HandleWritable(void)
}
if (IsConnected()) {
mutex::scoped_lock lock(m_QueueMutex);
boost::mutex::scoped_lock lock(m_QueueMutex);
m_SendQueue->Read(NULL, rc);
}