mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-08-13 20:43:08 +01:00
fixed possible crash at shutdown
This commit is contained in:
parent
7497741846
commit
3995448014
2 changed files with 8 additions and 1 deletions
libi2pd
|
@ -55,6 +55,13 @@ namespace transport
|
||||||
m_Thread->join ();
|
m_Thread->join ();
|
||||||
m_Thread = nullptr;
|
m_Thread = nullptr;
|
||||||
}
|
}
|
||||||
|
if (!m_Queue.empty ())
|
||||||
|
{
|
||||||
|
// clean up queue
|
||||||
|
std::queue<std::shared_ptr<Keys> > tmp;
|
||||||
|
std::swap (m_Queue, tmp);
|
||||||
|
}
|
||||||
|
m_KeysPool.CleanUpMt ();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Keys>
|
template<typename Keys>
|
||||||
|
|
|
@ -54,8 +54,8 @@ namespace transport
|
||||||
private:
|
private:
|
||||||
|
|
||||||
const int m_QueueSize;
|
const int m_QueueSize;
|
||||||
std::queue<std::shared_ptr<Keys> > m_Queue;
|
|
||||||
i2p::util::MemoryPoolMt<Keys> m_KeysPool;
|
i2p::util::MemoryPoolMt<Keys> m_KeysPool;
|
||||||
|
std::queue<std::shared_ptr<Keys> > m_Queue;
|
||||||
|
|
||||||
bool m_IsRunning;
|
bool m_IsRunning;
|
||||||
std::unique_ptr<std::thread> m_Thread;
|
std::unique_ptr<std::thread> m_Thread;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue