mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-15 03:08:36 +12:00
ppu: Fix threads scheduler
*Set priority under a lock *Fix yield command making threads going out of scheduler control by removing it from the queue (not a bug that affects compatibility)
This commit is contained in:
parent
3fd17e43a3
commit
3332a10052
2 changed files with 11 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
#include "stdafx.h"
|
||||
#include "stdafx.h"
|
||||
#include "Emu/System.h"
|
||||
|
||||
#include "Emu/Cell/PPUFunction.h"
|
||||
|
@ -1063,7 +1063,15 @@ void lv2_obj::awake(cpu_thread& cpu, u32 prio)
|
|||
|
||||
std::lock_guard lock(g_mutex);
|
||||
|
||||
if (prio == -4)
|
||||
if (prio < INT32_MAX)
|
||||
{
|
||||
// Priority set
|
||||
if (static_cast<ppu_thread&>(cpu).prio.exchange(prio) == prio || !unqueue(g_ppu, &cpu))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (prio == -4)
|
||||
{
|
||||
// Yield command
|
||||
const u64 start_time = get_system_time();
|
||||
|
@ -1087,12 +1095,6 @@ void lv2_obj::awake(cpu_thread& cpu, u32 prio)
|
|||
static_cast<ppu_thread&>(cpu).start_time = start_time;
|
||||
}
|
||||
|
||||
if (prio < INT32_MAX && !unqueue(g_ppu, &cpu))
|
||||
{
|
||||
// Priority set
|
||||
return;
|
||||
}
|
||||
|
||||
// Emplace current thread
|
||||
for (std::size_t i = 0; i <= g_ppu.size(); i++)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue