MTGS: Don't unlock mutex if you're just going to lock it again

Poor MTVU thread getting trolled by the GS thread.  By the time it wakes up its lock is taken again.  When under contention (GS thread behind the VU thread), this caused the GS thread to waste an additional 8% of its time pointlessly waking the VU thread
This commit is contained in:
TellowKrinkle 2021-03-28 05:26:46 -05:00 committed by Kojin
parent 881b017606
commit 85f1acb7b7
1 changed files with 7 additions and 4 deletions

View File

@ -436,10 +436,13 @@ void SysMtgsThread::ExecuteTaskInThread()
{
MTVU_LOG("MTGS - Waiting on semaXGkick!");
vu1Thread.KickStart(true);
busy.PartialRelease();
// Wait for MTVU to complete vu1 program
vu1Thread.semaXGkick.WaitWithoutYield();
busy.PartialAcquire();
if (!vu1Thread.semaXGkick.TryWait())
{
busy.PartialRelease();
// Wait for MTVU to complete vu1 program
vu1Thread.semaXGkick.WaitWithoutYield();
busy.PartialAcquire();
}
Gif_Path& path = gifUnit.gifPath[GIF_PATH_1];
GS_Packet gsPack = path.GetGSPacketMTVU(); // Get vu1 program's xgkick packet(s)
if (gsPack.size)