hrydgard/ppsspp — pull request #304 by unknownbrackets (2013-01-01 07:31:12+00:00)
Title: Prevent duplicate waiting threads in sema/mutex

If something did a tight loop of a short wait/timeout, it might end up getting on the waitingThreads list multiple times (since removing was deferred.) Eventually, this build up could cause a massive perf problem.

This (along with #303) fixes Senjou no Valkyria 3, which appears to now be fully playable (minor graphical issues and PGD aside.) It gets through the first chapter just fine, you can buy things and train, everything works. Some font characters are missing and there are only minor graphical issues (mainly shadows and lighting) with hardware transform disabled.

I was thinking about it, I guess the correct thing might be to check for timeouts of semas/etc. when considering thread switching. It seems like the hardware may only be checking a thread's timeout then. Maybe that would be simpler / have better performance.

That said, this is an easy improvement now and still passes all tests.

-[Unknown]