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)
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))
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();
}
static vector<Event> m_Events;
static condition_variable m_EventAvailable;
- static mutex m_Mutex;
+ static boost::mutex m_Mutex;
};
}
using boost::function;
using boost::thread;
using boost::thread_group;
-using boost::mutex;
using boost::condition_variable;
using boost::system_time;
using boost::tie;
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;
Object::Object(void)
{
#ifdef _DEBUG
- mutex::scoped_lock lock(m_Mutex);
+ boost::mutex::scoped_lock lock(m_Mutex);
m_AliveObjects.insert(this);
#endif /* _DEBUG */
}
Object::~Object(void)
{
#ifdef _DEBUG
- mutex::scoped_lock lock(m_Mutex);
+ boost::mutex::scoped_lock lock(m_Mutex);
m_AliveObjects.erase(this);
#endif /* _DEBUG */
}
*/
void Object::Hold(void)
{
- mutex::scoped_lock lock(m_Mutex);
+ boost::mutex::scoped_lock lock(m_Mutex);
m_HeldObjects.push_back(GetSelf());
}
*/
void Object::ClearHeldObjects(void)
{
- mutex::scoped_lock lock(m_Mutex);
+ boost::mutex::scoped_lock lock(m_Mutex);
m_HeldObjects.clear();
}
#ifdef _DEBUG
int Object::GetAliveObjects(void)
{
- mutex::scoped_lock lock(m_Mutex);
+ boost::mutex::scoped_lock lock(m_Mutex);
return m_AliveObjects.size();
}
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;
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;
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;
*/
Socket::~Socket(void)
{
- mutex::scoped_lock lock(m_SocketMutex);
+ boost::mutex::scoped_lock lock(m_SocketMutex);
CloseInternal(true);
}
*/
void Socket::Close(void)
{
- mutex::scoped_lock lock(m_SocketMutex);
+ boost::mutex::scoped_lock lock(m_SocketMutex);
CloseInternal(false);
}
*/
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);
*/
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);
void Socket::ReadThreadProc(void)
{
- mutex::scoped_lock lock(m_SocketMutex);
+ boost::mutex::scoped_lock lock(m_SocketMutex);
for (;;) {
fd_set readfds, exceptfds;
void Socket::WriteThreadProc(void)
{
- mutex::scoped_lock lock(m_SocketMutex);
+ boost::mutex::scoped_lock lock(m_SocketMutex);
for (;;) {
fd_set writefds;
virtual void CloseInternal(bool from_dtor);
- mutable mutex m_SocketMutex;
+ mutable boost::mutex m_SocketMutex;
private:
SOCKET m_FD; /**< The socket descriptor. */
for (;;) {
{
- mutex::scoped_lock lock(m_QueueMutex);
+ boost::mutex::scoped_lock lock(m_QueueMutex);
count = m_SendQueue->GetAvailableBytes();
throw_exception(SocketException("send() failed", GetError()));
{
- mutex::scoped_lock lock(m_QueueMutex);
+ boost::mutex::scoped_lock lock(m_QueueMutex);
m_SendQueue->Read(NULL, rc);
}
}
*/
size_t TcpClient::GetAvailableBytes(void) const
{
- mutex::scoped_lock lock(m_QueueMutex);
+ boost::mutex::scoped_lock lock(m_QueueMutex);
return m_RecvQueue->GetAvailableBytes();
}
*/
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);
}
*/
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);
}
*/
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);
}
throw_exception(SocketException("recv() failed", GetError()));
{
- mutex::scoped_lock lock(m_QueueMutex);
+ boost::mutex::scoped_lock lock(m_QueueMutex);
m_RecvQueue->Write(data, rc);
}
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;
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;
ThreadPool::~ThreadPool(void)
{
{
- mutex::scoped_lock lock(m_Lock);
+ boost::mutex::scoped_lock lock(m_Lock);
m_Tasks.clear();
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());
}
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);
}
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)
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())
void WaitForTasks(void);
private:
- mutable mutex m_Lock;
+ mutable boost::mutex m_Lock;
condition_variable m_CV;
list<ThreadPoolTask::Ptr> m_Tasks;
*/
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);
}
*/
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);
}
}
if (IsConnected()) {
- mutex::scoped_lock lock(m_QueueMutex);
+ boost::mutex::scoped_lock lock(m_QueueMutex);
m_RecvQueue->Write(data, rc);
}
if (IsConnected()) {
{
- mutex::scoped_lock lock(m_QueueMutex);
+ boost::mutex::scoped_lock lock(m_QueueMutex);
count = m_SendQueue->GetAvailableBytes();
}
if (IsConnected()) {
- mutex::scoped_lock lock(m_QueueMutex);
+ boost::mutex::scoped_lock lock(m_QueueMutex);
m_SendQueue->Read(NULL, rc);
}