-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete src/thread/n3ds/SDL_syscond.c #12116
base: main
Are you sure you want to change the base?
Conversation
This PR removes the incorrect implementation of `SDL_cond` currently included with the 3DS port. Pseudocode of the incorrect implementation of `SDL_CondWait` this PR removes: * Receive an `SDL_cond` backed by a `libctru` `CondVar` and an `SDL_mutex` backed by a `libctru` `RecursiveLock`. * Want to call `libctru` function `CondVar_Wait` which expects a `CondVar` and a `LightLock` (non-recursive lock) * Do so by calling this function with the internal (inadequately protected) `LightLock` member of the `RecursiveLock` (`&mutex->lock.lock` on line 105), without updating any internal thread or lock count fields of the `RecursiveLock`. Happy to discuss or test some examples. My own use case works much better with the generic cond logic, and this seems like a safe fix to me given that the generic logic is well-tested and this seems not to be. If you like the PR I'll send another one for the SDL2 branch.
Sorry for the failed build -- for some reason our |
@FtZPetruska what do you think about this? |
If it works better without, go ahead and get rid of that specialisation! For the background of this file... Well I simply brought it over from the SDL 1.2 port since there didn't seem to be any difference between the two 😅 |
There do appear to be some differences - in particular, the SDL 1.2 version clears the If applying that change doesn't fix the problem, it would probably be best to submit a bug report to libctru rather than replacing the use of |
For reference, we had a recent pr suggesting to remove ps2 timers. |
The SDL 1.x code may have been appropriate for something internal to devkitPro, but a client library reaching into the internals of the I wonder whether anyone here can speak to the performance characteristics of the generic |
This PR removes the incorrect specialized implementation of
SDL_cond
currently included with the 3DS port, allowing the generic implementation to be used.Description
Pseudocode of the incorrect implementation of
SDL_CondWait
this PR removes:SDL_cond
backed by alibctru
CondVar
and anSDL_mutex
backed by alibctru
RecursiveLock
.libctru
functionCondVar_Wait
which expects aCondVar
and aLightLock
(non-recursive lock)LightLock
member of theRecursiveLock
(&mutex->lock.lock
on line 105), without updating any internal thread or lock count fields of theRecursiveLock
.Happy to discuss or test some examples. My own use case works much better with the generic cond logic, and this seems like a safe fix to me given that the generic logic is well-tested and this seems not to be.
If you like the PR I'll send another one for the SDL2 branch.