mirror of https://github.com/aristocratos/btop.git
Changed: atomic_wait to use while loop instead of atom.wait() because of random stalls
This commit is contained in:
parent
5fba94c96c
commit
ff6d1d6eec
|
@ -269,13 +269,13 @@ namespace Tools {
|
|||
string hostname();
|
||||
string username();
|
||||
|
||||
#if __GNUC__ < 11
|
||||
// #if __GNUC__ < 11
|
||||
inline void atomic_wait(const atomic<bool>& atom, const bool old=true) noexcept { while (atom.load() == old) sleep_ms(1); }
|
||||
inline void atomic_notify(const atomic<bool>& atom) noexcept { (void)atom; }
|
||||
#else
|
||||
inline void atomic_wait(const atomic<bool>& atom, const bool old=true) noexcept { atom.wait(old); }
|
||||
inline void atomic_notify(const atomic<bool>& atom) noexcept { atom.notify_all(); }
|
||||
#endif
|
||||
// #else
|
||||
// inline void atomic_wait(const atomic<bool>& atom, const bool old=true) noexcept { if (atom == old) atom.wait(old); }
|
||||
// inline void atomic_notify(const atomic<bool>& atom) noexcept { atom.notify_all(); }
|
||||
// #endif
|
||||
|
||||
//* Waits for atomic<bool> to be false and sets it to true on construct, sets to false and notifies on destruct
|
||||
class atomic_lock {
|
||||
|
|
Loading…
Reference in New Issue