Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user_interface::alloc_thread_bit() usage #10846

Merged
merged 1 commit into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion rpcs3/Emu/RSX/Overlays/overlay_message_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,18 @@ namespace rsx
{
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;

*notify = true;
notify->notify_one();

if (interactive)
{
auto ref = g_fxo->get<display_manager>().get(uid);
Expand Down Expand Up @@ -275,6 +283,11 @@ namespace rsx
thread_bits &= ~tbit;
thread_bits.notify_all();
});

while (dlg_thread < thread_state::errored && !*notify)
{
notify->wait(false, atomic_wait_timeout{1'000'000});
}
}
}

Expand Down
15 changes: 14 additions & 1 deletion rpcs3/Emu/RSX/Overlays/overlay_osk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,10 +1034,18 @@ namespace rsx

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;

*notify = true;
notify->notify_one();

if (const auto error = run_input_loop())
{
rsx_log.error("Osk input loop exited with error code=%d", error);
Expand All @@ -1046,6 +1054,11 @@ namespace rsx
thread_bits &= ~tbit;
thread_bits.notify_all();
});

while (osk_thread < thread_state::errored && !*notify)
{
notify->wait(false, atomic_wait_timeout{1'000'000});
}
}
}
}
15 changes: 14 additions & 1 deletion rpcs3/Emu/RSX/Overlays/overlay_user_list_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,18 @@ namespace rsx
this->on_close = std::move(on_close);
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;

*notify = true;
notify->notify_one();

auto ref = g_fxo->get<display_manager>().get(uid);

if (const auto error = run_input_loop())
Expand All @@ -214,6 +222,11 @@ namespace rsx
thread_bits.notify_all();
});

while (list_thread < thread_state::errored && !*notify)
{
notify->wait(false, atomic_wait_timeout{1'000'000});
}

return CELL_OK;
}
} // namespace overlays
Expand Down