mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
Small workaround
This commit is contained in:
parent
5da33c6243
commit
54cdc41ac8
6 changed files with 32 additions and 28 deletions
|
|
@ -43,29 +43,22 @@ bool SSemaphore::try_wait()
|
|||
}
|
||||
}
|
||||
|
||||
void SSemaphore::post(u32 value)
|
||||
void SSemaphore::post()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
if (m_count >= m_max)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
else if (value > (m_max - m_count))
|
||||
{
|
||||
value = m_max - m_count;
|
||||
return;
|
||||
}
|
||||
|
||||
while (value)
|
||||
{
|
||||
m_count++;
|
||||
value--;
|
||||
m_cond.notify_one();
|
||||
}
|
||||
m_count++;
|
||||
m_cond.notify_one();
|
||||
}
|
||||
|
||||
bool SSemaphore::post_and_wait()
|
||||
{
|
||||
// TODO: ???
|
||||
if (try_wait()) return false;
|
||||
|
||||
post();
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
bool try_wait();
|
||||
|
||||
void post(u32 value = 1);
|
||||
void post();
|
||||
|
||||
bool post_and_wait();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue