Fix user_interface::alloc_thread_bit() usage

This commit is contained in:
Eladash 2021-09-09 22:23:04 +03:00 committed by Ivan
parent 50ad7ba1f6
commit 5600430a05
3 changed files with 42 additions and 3 deletions

View File

@ -242,10 +242,18 @@ namespace rsx
{ {
if (!exit) if (!exit)
{ {
g_fxo->get<named_thread<msg_dialog_thread>>()([&, tbit = alloc_thread_bit()]() auto& dlg_thread = g_fxo->get<named_thread<msg_dialog_thread>>();
const auto notify = std::make_shared<atomic_t<bool>>(false);
dlg_thread([&, notify]()
{ {
const u64 tbit = alloc_thread_bit();
g_thread_bit = tbit; g_thread_bit = tbit;
*notify = true;
notify->notify_one();
if (interactive) if (interactive)
{ {
auto ref = g_fxo->get<display_manager>().get(uid); auto ref = g_fxo->get<display_manager>().get(uid);
@ -275,6 +283,11 @@ namespace rsx
thread_bits &= ~tbit; thread_bits &= ~tbit;
thread_bits.notify_all(); thread_bits.notify_all();
}); });
while (dlg_thread < thread_state::errored && !*notify)
{
notify->wait(false, atomic_wait_timeout{1'000'000});
}
} }
} }

View File

@ -1034,10 +1034,18 @@ namespace rsx
update_panel(); update_panel();
g_fxo->get<named_thread<osk_dialog_thread>>()([this, tbit = alloc_thread_bit()] auto& osk_thread = g_fxo->get<named_thread<osk_dialog_thread>>();
const auto notify = std::make_shared<atomic_t<bool>>(false);
osk_thread([&, notify]()
{ {
const u64 tbit = alloc_thread_bit();
g_thread_bit = tbit; g_thread_bit = tbit;
*notify = true;
notify->notify_one();
if (const auto error = run_input_loop()) if (const 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);
@ -1046,6 +1054,11 @@ namespace rsx
thread_bits &= ~tbit; thread_bits &= ~tbit;
thread_bits.notify_all(); thread_bits.notify_all();
}); });
while (osk_thread < thread_state::errored && !*notify)
{
notify->wait(false, atomic_wait_timeout{1'000'000});
}
} }
} }
} }

View File

@ -199,10 +199,18 @@ namespace rsx
this->on_close = std::move(on_close); this->on_close = std::move(on_close);
visible = true; visible = true;
g_fxo->get<named_thread<user_list_dialog_thread>>()([&, tbit = alloc_thread_bit()]() auto& list_thread = g_fxo->get<named_thread<user_list_dialog_thread>>();
const auto notify = std::make_shared<atomic_t<bool>>(false);
list_thread([&, notify]()
{ {
const u64 tbit = alloc_thread_bit();
g_thread_bit = tbit; g_thread_bit = tbit;
*notify = true;
notify->notify_one();
auto ref = g_fxo->get<display_manager>().get(uid); auto ref = g_fxo->get<display_manager>().get(uid);
if (const auto error = run_input_loop()) if (const auto error = run_input_loop())
@ -214,6 +222,11 @@ namespace rsx
thread_bits.notify_all(); thread_bits.notify_all();
}); });
while (list_thread < thread_state::errored && !*notify)
{
notify->wait(false, atomic_wait_timeout{1'000'000});
}
return CELL_OK; return CELL_OK;
} }
} // namespace overlays } // namespace overlays