std::condvar is broken on Win32 with gcc/g++ 4.8 too
Use boost...
This commit is contained in:
parent
7c86c5997d
commit
014f8868f2
|
@ -30,8 +30,6 @@
|
||||||
#ifndef __WINH_OBJ_H__
|
#ifndef __WINH_OBJ_H__
|
||||||
#define __WINH_OBJ_H__
|
#define __WINH_OBJ_H__
|
||||||
|
|
||||||
#include <condition_variable>
|
|
||||||
#include <mutex>
|
|
||||||
#include <boost/thread/locks.hpp>
|
#include <boost/thread/locks.hpp>
|
||||||
#include <boost/thread/mutex.hpp>
|
#include <boost/thread/mutex.hpp>
|
||||||
#include <boost/thread/recursive_mutex.hpp>
|
#include <boost/thread/recursive_mutex.hpp>
|
||||||
|
@ -51,22 +49,22 @@ namespace epee
|
||||||
|
|
||||||
void raise()
|
void raise()
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(m_mx);
|
boost::unique_lock<boost::mutex> lock(m_mx);
|
||||||
m_rised = true;
|
m_rised = true;
|
||||||
m_cond_var.notify_one();
|
m_cond_var.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wait()
|
void wait()
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(m_mx);
|
boost::unique_lock<boost::mutex> lock(m_mx);
|
||||||
while (!m_rised)
|
while (!m_rised)
|
||||||
m_cond_var.wait(lock);
|
m_cond_var.wait(lock);
|
||||||
m_rised = false;
|
m_rised = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::mutex m_mx;
|
boost::mutex m_mx;
|
||||||
std::condition_variable m_cond_var;
|
boost::condition_variable m_cond_var;
|
||||||
bool m_rised;
|
bool m_rised;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
using namespace epee;
|
using namespace epee;
|
||||||
namespace bf = boost::filesystem;
|
namespace bf = boost::filesystem;
|
||||||
|
|
||||||
static std::mutex instance_lock;
|
static boost::mutex instance_lock;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -304,7 +304,7 @@ std::string DNSResolver::get_dns_format_from_oa_address(const std::string& oa_ad
|
||||||
|
|
||||||
DNSResolver& DNSResolver::instance()
|
DNSResolver& DNSResolver::instance()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(instance_lock);
|
boost::lock_guard<boost::mutex> lock(instance_lock);
|
||||||
|
|
||||||
static DNSResolver* staticInstance = NULL;
|
static DNSResolver* staticInstance = NULL;
|
||||||
if (staticInstance == NULL)
|
if (staticInstance == NULL)
|
||||||
|
|
Loading…
Reference in New Issue