Add thread_count instead of former thread pool

This commit is contained in:
Nekotekina 2020-02-25 23:16:55 +03:00
parent 982856e70d
commit ff16e678a5
4 changed files with 21 additions and 3 deletions

View file

@ -241,6 +241,8 @@ namespace rsx
{ {
if (!exit) if (!exit)
{ {
thread_count++;
g_fxo->init<named_thread>("MsgDialog Thread", [&]() g_fxo->init<named_thread>("MsgDialog Thread", [&]()
{ {
if (interactive) if (interactive)
@ -251,8 +253,6 @@ namespace rsx
{ {
rsx_log.error("Dialog input loop exited with error code=%d", error); rsx_log.error("Dialog input loop exited with error code=%d", error);
} }
verify(HERE), ref.get() == static_cast<overlay*>(this);
} }
else else
{ {
@ -264,6 +264,11 @@ namespace rsx
std::this_thread::sleep_for(16ms); std::this_thread::sleep_for(16ms);
} }
} }
if (!--thread_count)
{
thread_count.notify_all();
}
}); });
} }
} }

View file

@ -208,12 +208,19 @@ namespace rsx
fade_animation.duration = 0.5f; fade_animation.duration = 0.5f;
fade_animation.active = true; fade_animation.active = true;
thread_count++;
g_fxo->init<named_thread>("OSK Thread", [this] g_fxo->init<named_thread>("OSK Thread", [this]
{ {
if (auto error = run_input_loop()) if (auto error = run_input_loop())
{ {
rsx_log.error("Osk input loop exited with error code=%d", error); rsx_log.error("Osk input loop exited with error code=%d", error);
} }
if (!--thread_count)
{
thread_count.notify_all();
}
}); });
} }

View file

@ -158,6 +158,11 @@ namespace rsx
// Force unload // Force unload
exit.release(true); exit.release(true);
while (u32 i = thread_count)
{
thread_count.wait(i);
}
pad::SetIntercepted(false); pad::SetIntercepted(false);
if (on_close && use_callback) if (on_close && use_callback)

View file

@ -75,7 +75,8 @@ namespace rsx
protected: protected:
Timer input_timer; Timer input_timer;
atomic_t<bool> exit{ false }; atomic_t<bool> exit = false;
atomic_t<u32> thread_count = 0;
std::function<void(s32 status)> on_close; std::function<void(s32 status)> on_close;