mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12: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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue