Hotfix: useless error

This commit is contained in:
Nekotekina 2020-12-16 11:07:02 +03:00
parent 3dbecada4e
commit 6b3f722ff0
3 changed files with 11 additions and 5 deletions

View File

@ -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();

View File

@ -142,7 +142,7 @@ public:
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();
@ -393,7 +393,7 @@ public:
{
// Assign aborting state forcefully
operator=(thread_state::aborting);
thread::join();
thread::join(true);
if constexpr (!result::empty)
{

View File

@ -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;
{