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

Hotfix: useless error #9444

Merged
merged 1 commit into from Dec 16, 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
10 changes: 8 additions & 2 deletions Utilities/Thread.cpp
Expand Up @@ -2287,10 +2287,16 @@ thread_base::~thread_base()
}
}

bool thread_base::join() const
bool thread_base::join(bool dtor) const
{
// Check if already finished
if (m_sync & 2)
{
return (m_sync & 3) == 3;
}

// Hacked for too sleepy threads (1ms) TODO: make sure it's unneeded and remove
const auto timeout = Emu.IsStopped() ? atomic_wait_timeout{1'000'000} : atomic_wait_timeout::inf;
const auto timeout = dtor && Emu.IsStopped() ? atomic_wait_timeout{1'000'000} : atomic_wait_timeout::inf;

bool warn = false;
auto stamp0 = __rdtsc();
Expand Down
4 changes: 2 additions & 2 deletions Utilities/Thread.h
Expand Up @@ -142,7 +142,7 @@ class thread_base
u64 get_cycles();

// Wait for the thread (it does NOT change thread state, and can be called from multiple threads)
bool join() const;
bool join(bool dtor = false) const;

// Notify the thread
void notify();
Expand Down Expand Up @@ -393,7 +393,7 @@ class named_thread final : public Context, result_storage_t<Context>, thread_bas
{
// Assign aborting state forcefully
operator=(thread_state::aborting);
thread::join();
thread::join(true);

if constexpr (!result::empty)
{
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/main.cpp
Expand Up @@ -369,7 +369,7 @@ int main(int argc, char** argv)
#endif

// Initialize thread pool finalizer (on first use)
named_thread("", []{});
named_thread("", []{})();

std::unique_ptr<logs::listener> log_file;
{
Expand Down