CDVD: check if CDVD thread is already open

This commit is contained in:
unknown 2020-07-14 06:32:44 -07:00 committed by refractionpcsx2
parent 656efa5e20
commit 4df5c0ee1e
2 changed files with 18 additions and 13 deletions

View File

@ -144,12 +144,15 @@ void keepAliveThread()
bool StartKeepAliveThread()
{
s_keepalive_is_open = true;
try {
s_keepalive_thread = std::thread(keepAliveThread);
}
catch (std::system_error&) {
s_keepalive_is_open = false;
if (s_keepalive_is_open == false)
{
s_keepalive_is_open = true;
try {
s_keepalive_thread = std::thread(keepAliveThread);
}
catch (std::system_error&) {
s_keepalive_is_open = false;
}
}
return s_keepalive_is_open;

View File

@ -243,13 +243,15 @@ void cdvdThread()
bool cdvdStartThread()
{
cdvd_is_open = true;
try {
s_thread = std::thread(cdvdThread);
}
catch (std::system_error&) {
cdvd_is_open = false;
return false;
if (cdvd_is_open == false)
{
cdvd_is_open = true;
try {
s_thread = std::thread(cdvdThread);
} catch (std::system_error &) {
cdvd_is_open = false;
return false;
}
}
cdvdCacheReset();