diff --git a/src/btop.cpp b/src/btop.cpp index 69bb96c..d6510cd 100644 --- a/src/btop.cpp +++ b/src/btop.cpp @@ -230,11 +230,6 @@ void clean_quit(int sig) { Config::write(); - //? Wait for any remaining Tools::atomic_lock destructors to finish for max 1000ms - for (int i = 0; Tools::active_locks > 0 and i < 100; i++) { - sleep_ms(10); - } - if (Term::initialized) { Input::clear(); Term::restore(); diff --git a/src/btop_tools.cpp b/src/btop_tools.cpp index e9bfc2c..e283cb1 100644 --- a/src/btop_tools.cpp +++ b/src/btop_tools.cpp @@ -166,8 +166,6 @@ namespace Fx { namespace Tools { - atomic active_locks (0); - string uresize(string str, const size_t len, const bool wide) { if (len < 1 or str.empty()) return ""; for (size_t x = 0, i = 0; i < str.size(); i++) { @@ -367,14 +365,11 @@ namespace Tools { } atomic_lock::atomic_lock(atomic& atom, bool wait) : atom(atom) { - active_locks++; - if (wait) { - while (not this->atom.compare_exchange_strong(this->not_true, true)); - } else this->atom.store(true); + if (wait) while (not this->atom.compare_exchange_strong(this->not_true, true)); + else this->atom.store(true); } atomic_lock::~atomic_lock() { - active_locks--; this->atom.store(false); } diff --git a/src/btop_tools.hpp b/src/btop_tools.hpp index 705180c..6da5cb3 100644 --- a/src/btop_tools.hpp +++ b/src/btop_tools.hpp @@ -131,7 +131,6 @@ namespace Term { namespace Tools { constexpr auto SSmax = std::numeric_limits::max(); - extern atomic active_locks; //* Return number of UTF8 characters in a string (wide=true counts UTF-8 characters with a width > 1 as 2 characters) inline size_t ulen(const string& str, const bool wide=false) {