Repository navigation
fix(hle): release mutexes when their owner thread exits - #90
Merged
Merged
Conversation
A mutex stayed locked after its owner ended, so its waiters never woke. The kernel frees it on the PSP and hands it to the next waiter. An lwmutex stays locked there, because its state is in the guest's workarea, so only mutexes change, and a test pins the lwmutex behaviour. Verified: pspautotests threads/mutex and threads/lwmutex lock.expected; test_threadman_sync 5 failures before, 0 after; CTest 32/32; new_game.txt to vblank 9000 gives identical events, SHA-256 0364bf64f29b9434.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
exit_current_threadnow frees the mutexes of the ending thread and hands each to its next waiter. Before, waiters on such a mutex never woke.Issue #8 named lwmutexes too, but the PSP behaves differently there, so they stay as they are:
pspautotestslock.expectedAn lwmutex's state is in the guest's workarea, not in the kernel.
sceKernelTerminateThreadis not implemented anddelete_threadonly takes ended threads, so exit is the only path.Verification
test_threadman_sync: 3 new cases, 5 failed checks before the fix, 0 after.new_game.txtto vblank 9000 before and after: identical event dumps, SHA-2560364bf64f29b9434.... That route never ends a thread holding a mutex.Not verified
new_game.txt.Closes #8