mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-08 22:13:48 +01:00
don't use std::promise *
This commit is contained in:
parent
10ffdb2766
commit
ce97fa87e7
2 changed files with 5 additions and 7 deletions
|
@ -23,7 +23,7 @@ namespace data
|
||||||
{
|
{
|
||||||
NetDb netdb;
|
NetDb netdb;
|
||||||
|
|
||||||
NetDb::NetDb (): m_Ready(new std::promise<void>()), m_IsRunning (false), m_Thread (nullptr), m_Reseeder (nullptr), m_Storage("netDb", "r", "routerInfo-", "dat"), m_HiddenMode(false)
|
NetDb::NetDb (): m_IsRunning (false), m_Thread (nullptr), m_Reseeder (nullptr), m_Storage("netDb", "r", "routerInfo-", "dat"), m_HiddenMode(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ namespace data
|
||||||
|
|
||||||
m_IsRunning = true;
|
m_IsRunning = true;
|
||||||
m_Thread = new std::thread (std::bind (&NetDb::Run, this));
|
m_Thread = new std::thread (std::bind (&NetDb::Run, this));
|
||||||
m_Ready->set_value();
|
m_Ready.set_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetDb::Stop ()
|
void NetDb::Stop ()
|
||||||
|
@ -72,9 +72,7 @@ namespace data
|
||||||
|
|
||||||
void NetDb::WaitForReady()
|
void NetDb::WaitForReady()
|
||||||
{
|
{
|
||||||
m_Ready->get_future().wait();
|
m_Ready.get_future().get();
|
||||||
delete m_Ready;
|
|
||||||
m_Ready = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetDb::Run ()
|
void NetDb::Run ()
|
||||||
|
|
2
NetDb.h
2
NetDb.h
|
@ -112,7 +112,7 @@ namespace data
|
||||||
std::shared_ptr<const RouterInfo> GetRandomRouter (Filter filter) const;
|
std::shared_ptr<const RouterInfo> GetRandomRouter (Filter filter) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::promise<void> * m_Ready;
|
std::promise<void> m_Ready;
|
||||||
|
|
||||||
mutable std::mutex m_LeaseSetsMutex;
|
mutable std::mutex m_LeaseSetsMutex;
|
||||||
std::map<IdentHash, std::shared_ptr<LeaseSet> > m_LeaseSets;
|
std::map<IdentHash, std::shared_ptr<LeaseSet> > m_LeaseSets;
|
||||||
|
|
Loading…
Add table
Reference in a new issue