Small fixes

This commit is contained in:
Nekotekina 2014-06-25 02:16:44 +04:00
parent 336442eeba
commit 2200e6f4d9
5 changed files with 110 additions and 55 deletions

View file

@ -4,6 +4,8 @@ class SSemaphore
{
const u32 m_max;
u32 m_count;
u32 m_in_order;
u32 m_out_order;
std::mutex m_mutex, m_cv_mutex;
std::condition_variable m_cond;
@ -11,12 +13,16 @@ public:
SSemaphore(u32 value, u32 max = 1)
: m_max(max > 0 ? max : 0xffffffff)
, m_count(value > m_max ? m_max : value)
, m_in_order(0)
, m_out_order(0)
{
}
SSemaphore()
: m_max(0xffffffff)
, m_count(0)
, m_in_order(0)
, m_out_order(0)
{
}
@ -24,7 +30,7 @@ public:
{
}
bool wait(u64 timeout = 0);
void wait();
bool try_wait();