Improve vm::reservation_op

Remove XABORT, sync status handling with SPU/PPU transaction.
Limit max number of transaction attempts in loop.
Add Ack template parameter, as in vm::reservation_light_op.
Remove utils::tx_abort, improve utils::tx_start as well.
This commit is contained in:
Nekotekina 2020-10-20 08:41:10 +03:00
parent dc8252bb9f
commit 4384ae15b4
3 changed files with 55 additions and 80 deletions

View file

@ -509,25 +509,18 @@ namespace vm
void reservation_op_internal(u32 addr, std::function<bool()> func)
{
const bool ok = cpu_thread::suspend_all(get_current_cpu_thread(), [&]
cpu_thread::suspend_all(get_current_cpu_thread(), [&]
{
if (func())
{
// Success, release all locks if necessary
vm::reservation_acquire(addr, 128) += 127;
return true;
}
else
{
vm::reservation_acquire(addr, 128) -= 1;
return false;
}
});
if (ok)
{
vm::reservation_notifier(addr, 128).notify_all();
}
}
void reservation_escape_internal()