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

Unnatural fixes #7753

Merged
merged 3 commits into from Mar 10, 2020
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
2 changes: 1 addition & 1 deletion Utilities/Thread.cpp
Expand Up @@ -1912,6 +1912,7 @@ bool thread_base::finalize(int) noexcept

void thread_base::finalize() noexcept
{
atomic_storage_futex::set_wait_callback([](const void*){ return true; });
g_tls_log_prefix = []() -> std::string { return {}; };
thread_ctrl::g_tls_this_thread = nullptr;
}
Expand Down Expand Up @@ -2091,7 +2092,6 @@ void thread_ctrl::emergency_exit(std::string_view reason)
delete _this;
}

// Do some not very useful cleanup
thread_base::finalize();

#ifdef _WIN32
Expand Down
10 changes: 5 additions & 5 deletions rpcs3/Emu/System.cpp
Expand Up @@ -1645,17 +1645,17 @@ void Emulator::Stop(bool restart)

named_thread stop_watchdog("Stop Watchdog", [&]()
{
const auto start = std::chrono::steady_clock::now();

while (thread_ctrl::state() != thread_state::aborting)
for (uint i = 0; thread_ctrl::state() != thread_state::aborting; i++)
{
if (std::chrono::steady_clock::now() - start >= 5s)
// We don't need accurate timekeeping, using clocks may interfere with debugging
if (i >= 1000)
{
// Total amount of waiting: about 5s
report_fatal_error("Stopping emulator took too long."
"\nSome thread has probably deadlocked. Aborting.");
}

thread_ctrl::wait_for(100'000);
thread_ctrl::wait_for(5'000);
}
});

Expand Down
11 changes: 10 additions & 1 deletion rpcs3/main.cpp
Expand Up @@ -271,7 +271,16 @@ int main(int argc, char** argv)
// Only run RPCS3 to display an error
if (int err_pos = find_arg(arg_error, argc, argv))
{
report_fatal_error(argv[err_pos + 1]);
// Reconstruction of the error from multiple args
std::string error;
for (int i = err_pos + 1; i < argc; i++)
{
if (i > err_pos + 1)
error += ' ';
error += argv[i];
}

report_fatal_error(error);
}

const std::string lock_name = fs::get_cache_dir() + "RPCS3.buf";
Expand Down