-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
[WIP] Multithreading fixes #152
Conversation
src/core/kernel/events.cpp
Outdated
@@ -48,7 +48,7 @@ bool Kernel::signalEvent(Handle handle) { | |||
// We must reschedule our threads if we signalled one. Some games such as FE: Awakening rely on this | |||
// If this does not happen, we can have phenomena such as a thread waiting up a higher priority thread, | |||
// and the higher priority thread just never running | |||
rescheduleThreads(); | |||
requireReschedule(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this should happen.
Also need to investigate how OneShot events work a bit better
@@ -121,7 +121,6 @@ void Kernel::waitSynchronization1() { | |||
if (!shouldWaitOnObject(object)) { | |||
acquireSyncObject(object, threads[currentThreadIndex]); // Acquire the object since it's ready | |||
regs[0] = Result::Success; | |||
rescheduleThreads(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may or may not need to request a reschedule, still
if (!waitAll) { | ||
// If there's ready objects, acquire the first one and return | ||
if (oneObjectReady) { | ||
regs[0] = Result::Success; | ||
regs[1] = firstReadyObjectIndex; // Return index of the acquired object | ||
acquireSyncObject(waitObjects[firstReadyObjectIndex].second, t); // Acquire object | ||
rescheduleThreads(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto from WaitSync1
Note: some of the games above need my local "Sleep thread on SendSyncRequest" as well |
2ae08e3
to
57c3224
Compare
222d0a3
to
60de6a6
Compare
(This code will likely be revisited soon but might as well merge it) |
Various changes to the thread scheduler. Fixes or improves a bunch of games including the following
This is still WIP and won't be merged until all regressions are fixed and some stubborn games are fixed
Partially covers #124