Make discord code more thread safe
This commit is contained in:
parent
f2cc6559e6
commit
da05d1e905
@ -78,6 +78,12 @@ void RichPresence::terminate()
|
||||
#else
|
||||
#define UNCLEAN m_socket != -1
|
||||
#endif
|
||||
if(m_thread != nullptr && STKProcess::getType() == PT_MAIN)
|
||||
{
|
||||
m_thread->join();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
}
|
||||
if (m_connected || UNCLEAN)
|
||||
{
|
||||
if (UNCLEAN && !m_connected)
|
||||
@ -92,12 +98,6 @@ void RichPresence::terminate()
|
||||
m_connected = false;
|
||||
m_ready = false;
|
||||
}
|
||||
if(m_thread != nullptr && STKProcess::getType() == PT_MAIN)
|
||||
{
|
||||
m_thread->join();
|
||||
delete m_thread;
|
||||
m_thread = nullptr;
|
||||
}
|
||||
#endif // DISABLE_RPC
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <atomic>
|
||||
#ifdef WIN32
|
||||
#include <namedpipeapi.h>
|
||||
#endif
|
||||
@ -21,7 +22,7 @@ namespace RichPresenceNS
|
||||
{
|
||||
private:
|
||||
bool m_connected;
|
||||
bool m_ready;
|
||||
std::atomic_bool m_ready;
|
||||
time_t m_last;
|
||||
#ifdef WIN32
|
||||
HANDLE m_socket;
|
||||
|
Loading…
Reference in New Issue
Block a user