Rewrite condition variables

Implement helper functions balanced_wait_until and balanced_awaken
They include new path for Windows 8.1+ (WaitOnAddress)

shared_mutex, cond_variable, cond_one, cond_x16 modified to use it
Added helper function utils::popcnt16
Replace most semaphore<> with shared_mutex
This commit is contained in:
Nekotekina 2018-11-26 18:55:22 +03:00
parent f442a8a84c
commit 96cabeadff
23 changed files with 269 additions and 338 deletions

View file

@ -75,7 +75,7 @@ namespace logs
#endif
uchar* m_fptr{};
z_stream m_zs{};
semaphore<> m_m;
shared_mutex m_m;
alignas(128) atomic_t<u64> m_buf{0}; // MSB (40 bit): push begin, LSB (24 bis): push size
alignas(128) atomic_t<u64> m_out{0}; // Amount of bytes written to file
@ -183,7 +183,7 @@ namespace logs
channel SPU("SPU");
// Channel registry mutex
semaphore<> g_mutex;
shared_mutex g_mutex;
// Must be set to true in main()
atomic_t<bool> g_init{false};