N3DS: Semaphore fixes. (#6776)

* N3DS: Make Sem waits cooperative friendly.

The 3DS has a cooperative threading model. Sleeping after TryWait and
WaitTimeout avoid starving other threads. It inccurs a runtime penalty,
but it's better than having to hard reset your console to recover from
a deadlock.
This commit is contained in:
Pierre Wendling
2022-12-11 14:27:16 -05:00
committed by GitHub
parent bb6abd7b03
commit 053ce39d67
4 changed files with 34 additions and 27 deletions

View File

@@ -208,6 +208,8 @@ TestOverheadContended(SDL_bool try_wait)
}
/* Make sure threads consumed everything */
while (SDL_SemValue(sem)) {
/* Friendlier with cooperative threading models */
SDL_DelayNS(1);
}
}
end_ticks = SDL_GetTicks();