mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-20 12:14:44 +02:00
Build fix for Solaris.
This commit is contained in:
parent
1e0bb5d51c
commit
c5c534b55b
@ -23,7 +23,7 @@ using namespace icinga;
|
|||||||
|
|
||||||
vector<Event> Event::m_Events;
|
vector<Event> Event::m_Events;
|
||||||
condition_variable Event::m_EventAvailable;
|
condition_variable Event::m_EventAvailable;
|
||||||
mutex Event::m_Mutex;
|
boost::mutex Event::m_Mutex;
|
||||||
|
|
||||||
Event::Event(const Event::Callback& callback)
|
Event::Event(const Event::Callback& callback)
|
||||||
: m_Callback(callback)
|
: m_Callback(callback)
|
||||||
@ -34,7 +34,7 @@ void Event::ProcessEvents(const system_time& wait_until)
|
|||||||
vector<Event> events;
|
vector<Event> events;
|
||||||
|
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
|
||||||
while (m_Events.empty()) {
|
while (m_Events.empty()) {
|
||||||
if (!m_EventAvailable.timed_wait(lock, wait_until))
|
if (!m_EventAvailable.timed_wait(lock, wait_until))
|
||||||
@ -69,7 +69,7 @@ void Event::Post(const Event::Callback& callback)
|
|||||||
Event ev(callback);
|
Event ev(callback);
|
||||||
|
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
m_Events.push_back(ev);
|
m_Events.push_back(ev);
|
||||||
m_EventAvailable.notify_all();
|
m_EventAvailable.notify_all();
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ private:
|
|||||||
|
|
||||||
static vector<Event> m_Events;
|
static vector<Event> m_Events;
|
||||||
static condition_variable m_EventAvailable;
|
static condition_variable m_EventAvailable;
|
||||||
static mutex m_Mutex;
|
static boost::mutex m_Mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,6 @@ using boost::static_pointer_cast;
|
|||||||
using boost::function;
|
using boost::function;
|
||||||
using boost::thread;
|
using boost::thread;
|
||||||
using boost::thread_group;
|
using boost::thread_group;
|
||||||
using boost::mutex;
|
|
||||||
using boost::condition_variable;
|
using boost::condition_variable;
|
||||||
using boost::system_time;
|
using boost::system_time;
|
||||||
using boost::tie;
|
using boost::tie;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
mutex Object::m_Mutex;
|
boost::mutex Object::m_Mutex;
|
||||||
vector<Object::Ptr> Object::m_HeldObjects;
|
vector<Object::Ptr> Object::m_HeldObjects;
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
set<Object *> Object::m_AliveObjects;
|
set<Object *> Object::m_AliveObjects;
|
||||||
@ -33,7 +33,7 @@ set<Object *> Object::m_AliveObjects;
|
|||||||
Object::Object(void)
|
Object::Object(void)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
m_AliveObjects.insert(this);
|
m_AliveObjects.insert(this);
|
||||||
#endif /* _DEBUG */
|
#endif /* _DEBUG */
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ Object::Object(void)
|
|||||||
Object::~Object(void)
|
Object::~Object(void)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
m_AliveObjects.erase(this);
|
m_AliveObjects.erase(this);
|
||||||
#endif /* _DEBUG */
|
#endif /* _DEBUG */
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ Object::~Object(void)
|
|||||||
*/
|
*/
|
||||||
void Object::Hold(void)
|
void Object::Hold(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
m_HeldObjects.push_back(GetSelf());
|
m_HeldObjects.push_back(GetSelf());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ void Object::Hold(void)
|
|||||||
*/
|
*/
|
||||||
void Object::ClearHeldObjects(void)
|
void Object::ClearHeldObjects(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
m_HeldObjects.clear();
|
m_HeldObjects.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ Object::SharedPtrHolder Object::GetSelf(void)
|
|||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
int Object::GetAliveObjects(void)
|
int Object::GetAliveObjects(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
return m_AliveObjects.size();
|
return m_AliveObjects.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ void Object::PrintMemoryProfile(void)
|
|||||||
ofstream dictfp("dictionaries.dump.tmp");
|
ofstream dictfp("dictionaries.dump.tmp");
|
||||||
|
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
set<Object *>::iterator it;
|
set<Object *>::iterator it;
|
||||||
BOOST_FOREACH(Object *obj, m_AliveObjects) {
|
BOOST_FOREACH(Object *obj, m_AliveObjects) {
|
||||||
pair<map<String, int>::iterator, bool> tt;
|
pair<map<String, int>::iterator, bool> tt;
|
||||||
|
@ -88,7 +88,7 @@ private:
|
|||||||
Object(const Object& other);
|
Object(const Object& other);
|
||||||
Object& operator=(const Object& rhs);
|
Object& operator=(const Object& rhs);
|
||||||
|
|
||||||
static mutex m_Mutex;
|
static boost::mutex m_Mutex;
|
||||||
static vector<Object::Ptr> m_HeldObjects;
|
static vector<Object::Ptr> m_HeldObjects;
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
static set<Object *> m_AliveObjects;
|
static set<Object *> m_AliveObjects;
|
||||||
|
@ -43,14 +43,14 @@ Process::Process(const String& command)
|
|||||||
|
|
||||||
void Process::Run(void)
|
void Process::Run(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
m_Tasks.push_back(GetSelf());
|
m_Tasks.push_back(GetSelf());
|
||||||
m_TasksCV.notify_all();
|
m_TasksCV.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Process::WorkerThreadProc(void)
|
void Process::WorkerThreadProc(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
|
||||||
map<int, Process::Ptr> tasks;
|
map<int, Process::Ptr> tasks;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ Socket::Socket(void)
|
|||||||
*/
|
*/
|
||||||
Socket::~Socket(void)
|
Socket::~Socket(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_SocketMutex);
|
boost::mutex::scoped_lock lock(m_SocketMutex);
|
||||||
CloseInternal(true);
|
CloseInternal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ SOCKET Socket::GetFD(void) const
|
|||||||
*/
|
*/
|
||||||
void Socket::Close(void)
|
void Socket::Close(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_SocketMutex);
|
boost::mutex::scoped_lock lock(m_SocketMutex);
|
||||||
|
|
||||||
CloseInternal(false);
|
CloseInternal(false);
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ String Socket::GetAddressFromSockaddr(sockaddr *address, socklen_t len)
|
|||||||
*/
|
*/
|
||||||
String Socket::GetClientAddress(void)
|
String Socket::GetClientAddress(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_SocketMutex);
|
boost::mutex::scoped_lock lock(m_SocketMutex);
|
||||||
|
|
||||||
sockaddr_storage sin;
|
sockaddr_storage sin;
|
||||||
socklen_t len = sizeof(sin);
|
socklen_t len = sizeof(sin);
|
||||||
@ -227,7 +227,7 @@ String Socket::GetClientAddress(void)
|
|||||||
*/
|
*/
|
||||||
String Socket::GetPeerAddress(void)
|
String Socket::GetPeerAddress(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_SocketMutex);
|
boost::mutex::scoped_lock lock(m_SocketMutex);
|
||||||
|
|
||||||
sockaddr_storage sin;
|
sockaddr_storage sin;
|
||||||
socklen_t len = sizeof(sin);
|
socklen_t len = sizeof(sin);
|
||||||
@ -258,7 +258,7 @@ SocketException::SocketException(const String& message, int errorCode)
|
|||||||
|
|
||||||
void Socket::ReadThreadProc(void)
|
void Socket::ReadThreadProc(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_SocketMutex);
|
boost::mutex::scoped_lock lock(m_SocketMutex);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
fd_set readfds, exceptfds;
|
fd_set readfds, exceptfds;
|
||||||
@ -312,7 +312,7 @@ void Socket::ReadThreadProc(void)
|
|||||||
|
|
||||||
void Socket::WriteThreadProc(void)
|
void Socket::WriteThreadProc(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_SocketMutex);
|
boost::mutex::scoped_lock lock(m_SocketMutex);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
fd_set writefds;
|
fd_set writefds;
|
||||||
|
@ -68,7 +68,7 @@ protected:
|
|||||||
|
|
||||||
virtual void CloseInternal(bool from_dtor);
|
virtual void CloseInternal(bool from_dtor);
|
||||||
|
|
||||||
mutable mutex m_SocketMutex;
|
mutable boost::mutex m_SocketMutex;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SOCKET m_FD; /**< The socket descriptor. */
|
SOCKET m_FD; /**< The socket descriptor. */
|
||||||
|
@ -115,7 +115,7 @@ void TcpClient::HandleWritable(void)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_QueueMutex);
|
boost::mutex::scoped_lock lock(m_QueueMutex);
|
||||||
|
|
||||||
count = m_SendQueue->GetAvailableBytes();
|
count = m_SendQueue->GetAvailableBytes();
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ void TcpClient::HandleWritable(void)
|
|||||||
throw_exception(SocketException("send() failed", GetError()));
|
throw_exception(SocketException("send() failed", GetError()));
|
||||||
|
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_QueueMutex);
|
boost::mutex::scoped_lock lock(m_QueueMutex);
|
||||||
m_SendQueue->Read(NULL, rc);
|
m_SendQueue->Read(NULL, rc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ void TcpClient::HandleWritable(void)
|
|||||||
*/
|
*/
|
||||||
size_t TcpClient::GetAvailableBytes(void) const
|
size_t TcpClient::GetAvailableBytes(void) const
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_QueueMutex);
|
boost::mutex::scoped_lock lock(m_QueueMutex);
|
||||||
|
|
||||||
return m_RecvQueue->GetAvailableBytes();
|
return m_RecvQueue->GetAvailableBytes();
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ size_t TcpClient::GetAvailableBytes(void) const
|
|||||||
*/
|
*/
|
||||||
void TcpClient::Peek(void *buffer, size_t count)
|
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);
|
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)
|
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);
|
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)
|
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);
|
m_SendQueue->Write(buffer, count);
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ void TcpClient::HandleReadable(void)
|
|||||||
throw_exception(SocketException("recv() failed", GetError()));
|
throw_exception(SocketException("recv() failed", GetError()));
|
||||||
|
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_QueueMutex);
|
boost::mutex::scoped_lock lock(m_QueueMutex);
|
||||||
|
|
||||||
m_RecvQueue->Write(data, rc);
|
m_RecvQueue->Write(data, rc);
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ bool TcpClient::WantsToRead(void) const
|
|||||||
bool TcpClient::WantsToWrite(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)
|
if (m_SendQueue->GetAvailableBytes() > 0)
|
||||||
return true;
|
return true;
|
||||||
|
@ -68,7 +68,7 @@ protected:
|
|||||||
virtual void HandleReadable(void);
|
virtual void HandleReadable(void);
|
||||||
virtual void HandleWritable(void);
|
virtual void HandleWritable(void);
|
||||||
|
|
||||||
mutable mutex m_QueueMutex;
|
mutable boost::mutex m_QueueMutex;
|
||||||
FIFO::Ptr m_SendQueue;
|
FIFO::Ptr m_SendQueue;
|
||||||
FIFO::Ptr m_RecvQueue;
|
FIFO::Ptr m_RecvQueue;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ ThreadPool::ThreadPool(long numThreads)
|
|||||||
ThreadPool::~ThreadPool(void)
|
ThreadPool::~ThreadPool(void)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_Lock);
|
boost::mutex::scoped_lock lock(m_Lock);
|
||||||
|
|
||||||
m_Tasks.clear();
|
m_Tasks.clear();
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ ThreadPool::~ThreadPool(void)
|
|||||||
void ThreadPool::EnqueueTasks(list<ThreadPoolTask::Ptr>& tasks)
|
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());
|
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)
|
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);
|
m_Tasks.push_back(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ void ThreadPool::EnqueueTask(const ThreadPoolTask::Ptr& task)
|
|||||||
|
|
||||||
ThreadPoolTask::Ptr ThreadPool::DequeueTask(void)
|
ThreadPoolTask::Ptr ThreadPool::DequeueTask(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_Lock);
|
boost::mutex::scoped_lock lock(m_Lock);
|
||||||
|
|
||||||
while (m_Tasks.empty()) {
|
while (m_Tasks.empty()) {
|
||||||
if (!m_Alive)
|
if (!m_Alive)
|
||||||
@ -83,7 +83,7 @@ ThreadPoolTask::Ptr ThreadPool::DequeueTask(void)
|
|||||||
|
|
||||||
void ThreadPool::WaitForTasks(void)
|
void ThreadPool::WaitForTasks(void)
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_Lock);
|
boost::mutex::scoped_lock lock(m_Lock);
|
||||||
|
|
||||||
/* wait for all pending tasks */
|
/* wait for all pending tasks */
|
||||||
while (!m_Tasks.empty())
|
while (!m_Tasks.empty())
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
void WaitForTasks(void);
|
void WaitForTasks(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable mutex m_Lock;
|
mutable boost::mutex m_Lock;
|
||||||
condition_variable m_CV;
|
condition_variable m_CV;
|
||||||
|
|
||||||
list<ThreadPoolTask::Ptr> m_Tasks;
|
list<ThreadPoolTask::Ptr> m_Tasks;
|
||||||
|
@ -80,7 +80,7 @@ void TlsClient::Start(void)
|
|||||||
*/
|
*/
|
||||||
shared_ptr<X509> TlsClient::GetClientCertificate(void) const
|
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);
|
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
|
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);
|
return shared_ptr<X509>(SSL_get_peer_certificate(m_SSL.get()), X509_free);
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ void TlsClient::HandleReadable(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IsConnected()) {
|
if (IsConnected()) {
|
||||||
mutex::scoped_lock lock(m_QueueMutex);
|
boost::mutex::scoped_lock lock(m_QueueMutex);
|
||||||
|
|
||||||
m_RecvQueue->Write(data, rc);
|
m_RecvQueue->Write(data, rc);
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ void TlsClient::HandleWritable(void)
|
|||||||
|
|
||||||
if (IsConnected()) {
|
if (IsConnected()) {
|
||||||
{
|
{
|
||||||
mutex::scoped_lock lock(m_QueueMutex);
|
boost::mutex::scoped_lock lock(m_QueueMutex);
|
||||||
|
|
||||||
count = m_SendQueue->GetAvailableBytes();
|
count = m_SendQueue->GetAvailableBytes();
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ void TlsClient::HandleWritable(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IsConnected()) {
|
if (IsConnected()) {
|
||||||
mutex::scoped_lock lock(m_QueueMutex);
|
boost::mutex::scoped_lock lock(m_QueueMutex);
|
||||||
|
|
||||||
m_SendQueue->Read(NULL, rc);
|
m_SendQueue->Read(NULL, rc);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user