mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-16 03:38:38 +12:00
cellMic: Fix potential overflow
This commit is contained in:
parent
d451c0867c
commit
700334753d
1 changed files with 3 additions and 4 deletions
|
@ -73,14 +73,13 @@ void mic_context::operator()()
|
||||||
// Timestep in microseconds
|
// Timestep in microseconds
|
||||||
constexpr u64 TIMESTEP = 256ull * 1'000'000ull / 48000ull;
|
constexpr u64 TIMESTEP = 256ull * 1'000'000ull / 48000ull;
|
||||||
u64 timeout = 0;
|
u64 timeout = 0;
|
||||||
u32 oldvalue = 0;
|
|
||||||
|
|
||||||
while (thread_ctrl::state() != thread_state::aborting)
|
while (thread_ctrl::state() != thread_state::aborting)
|
||||||
{
|
{
|
||||||
if (timeout != 0)
|
if (timeout != 0)
|
||||||
{
|
{
|
||||||
thread_ctrl::wait_on(wakey, oldvalue, timeout);
|
thread_ctrl::wait_on(wakey, 0, timeout);
|
||||||
oldvalue = wakey;
|
wakey.store(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard lock(mutex);
|
std::lock_guard lock(mutex);
|
||||||
|
@ -124,7 +123,7 @@ void mic_context::operator()()
|
||||||
|
|
||||||
void mic_context::wake_up()
|
void mic_context::wake_up()
|
||||||
{
|
{
|
||||||
wakey++;
|
wakey.store(1);
|
||||||
wakey.notify_one();
|
wakey.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue