Remove global thread counter (again)

Seems fine without it now.
This commit is contained in:
Nekotekina 2020-02-28 21:50:19 +03:00
parent 490f58ff3c
commit 799c3f9708
3 changed files with 0 additions and 17 deletions

View File

@ -1722,8 +1722,6 @@ DECLARE(thread_ctrl::g_native_core_layout) { native_core_arrangement::undefined
void thread_base::start(native_entry entry) void thread_base::start(native_entry entry)
{ {
thread_ctrl::g_thread_count++;
#ifdef _WIN32 #ifdef _WIN32
m_thread = ::_beginthreadex(nullptr, 0, entry, this, CREATE_SUSPENDED, nullptr); m_thread = ::_beginthreadex(nullptr, 0, entry, this, CREATE_SUSPENDED, nullptr);
verify("thread_ctrl::start" HERE), m_thread, ::ResumeThread(reinterpret_cast<HANDLE>(+m_thread)) != -1; verify("thread_ctrl::start" HERE), m_thread, ::ResumeThread(reinterpret_cast<HANDLE>(+m_thread)) != -1;
@ -1871,7 +1869,6 @@ void thread_base::finalize() noexcept
{ {
g_tls_log_prefix = []() -> std::string { return {}; }; g_tls_log_prefix = []() -> std::string { return {}; };
thread_ctrl::g_tls_this_thread = nullptr; thread_ctrl::g_tls_this_thread = nullptr;
thread_ctrl::g_thread_count--;
} }
void thread_ctrl::_wait_for(u64 usec, bool alert /* true */) void thread_ctrl::_wait_for(u64 usec, bool alert /* true */)

View File

@ -171,9 +171,6 @@ class thread_ctrl final
// Target cpu core layout // Target cpu core layout
static atomic_t<native_core_arrangement> g_native_core_layout; static atomic_t<native_core_arrangement> g_native_core_layout;
// Global thread counter
static inline atomic_t<u64> g_thread_count = 0;
// Internal waiting function, may throw. Infinite value is -1. // Internal waiting function, may throw. Infinite value is -1.
static void _wait_for(u64 usec, bool alert); static void _wait_for(u64 usec, bool alert);
@ -260,11 +257,6 @@ public:
return g_tls_this_thread; return g_tls_this_thread;
} }
static u64 get_count()
{
return g_thread_count.load();
}
// Detect layout // Detect layout
static void detect_cpu_layout(); static void detect_cpu_layout();

View File

@ -1638,12 +1638,6 @@ void Emulator::Stop(bool restart)
cpu_thread::stop_all(); cpu_thread::stop_all();
g_fxo->reset(); g_fxo->reset();
while (u32 x = thread_ctrl::get_count())
{
sys_log.fatal("Waiting for %u threads...", x);
std::this_thread::sleep_for(300ms);
}
sys_log.notice("All threads have been stopped."); sys_log.notice("All threads have been stopped.");
lv2_obj::cleanup(); lv2_obj::cleanup();