diff options
Diffstat (limited to 'Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/TimedAction.cs')
| -rw-r--r-- | Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/TimedAction.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/TimedAction.cs b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/TimedAction.cs index 8884bdcf..0de78a0e 100644 --- a/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/TimedAction.cs +++ b/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/TimedAction.cs @@ -144,6 +144,20 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard }), cancelled); } + public void Reset(Action action) + { + // Create a dedicated cancel token for each task. + var cancelled = new TRef<bool>(false); + + Reset(new Thread(() => + { + while (!Volatile.Read(ref cancelled.Value)) + { + action(); + } + }), cancelled); + } + private static bool SleepWithSubstep(SleepSubstepData substepData, TRef<bool> cancelled) { for (int i = 0; i < substepData.SleepCount; i++) |
