mirror of
https://github.com/aristocratos/btop.git
synced 2024-05-20 20:32:50 +12:00
Removed: Unnecessary counter for atomic_lock
This commit is contained in:
parent
08f3957817
commit
8e81bf2ccb
|
@ -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();
|
||||
|
|
|
@ -166,8 +166,6 @@ namespace Fx {
|
|||
|
||||
namespace Tools {
|
||||
|
||||
atomic<int> 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<bool>& 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,6 @@ namespace Term {
|
|||
|
||||
namespace Tools {
|
||||
constexpr auto SSmax = std::numeric_limits<std::streamsize>::max();
|
||||
extern atomic<int> 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) {
|
||||
|
|
Loading…
Reference in a new issue