mirror of
https://github.com/aristocratos/btop.git
synced 2024-09-29 08:41:19 +13:00
Changed: atomic_wait to use while loop instead of atom.wait() because of random stalls
This commit is contained in:
parent
5fba94c96c
commit
ff6d1d6eec
1 changed files with 5 additions and 5 deletions
|
@ -269,13 +269,13 @@ namespace Tools {
|
||||||
string hostname();
|
string hostname();
|
||||||
string username();
|
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_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; }
|
inline void atomic_notify(const atomic<bool>& atom) noexcept { (void)atom; }
|
||||||
#else
|
// #else
|
||||||
inline void atomic_wait(const atomic<bool>& atom, const bool old=true) noexcept { atom.wait(old); }
|
// 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(); }
|
// inline void atomic_notify(const atomic<bool>& atom) noexcept { atom.notify_all(); }
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
//* Waits for atomic<bool> to be false and sets it to true on construct, sets to false and notifies on destruct
|
//* Waits for atomic<bool> to be false and sets it to true on construct, sets to false and notifies on destruct
|
||||||
class atomic_lock {
|
class atomic_lock {
|
||||||
|
|
Loading…
Reference in a new issue