Commit Graph
28 Commits
Author SHA1 Message Date
Henrik Rydgård 6b0903f566 Add facility to run tasks on dedicated threads using the ThreadManager interface.
Useful for things that should be run ASAP even if the threadpool is full,
at a small extra cost. (Not recommended for very small tasks).

Considering using this to resolve the deadlocks in #16802.
2023-01-31 11:07:40 +01:00
Unknown W. Brackets 3a6fa9b4ba ThreadManager: Don't allow reordering of queue.
Allowing a priority item is faster, but can cause confusion when you
expect things to run in the same sequence they're enqueued.
2023-01-14 16:35:01 -08:00
Henrik Rydgård b56eef487c Strict mode checking - no way to forget detaching now.
And if we forget to attach, boom. Hopefully I caught all of them.
2023-01-05 08:38:52 +01:00
Henrik Rydgård 916404f0e4 Try to get a bit better at detaching threads that have used JNI from the VM. 2023-01-05 08:38:49 +01:00
Unknown W. Brackets a800938604 Common: Fix worker thread names. 2022-12-10 10:40:32 -08:00
Johan MattssonandGitHub 2b1d57257a Fix comparison 2022-12-03 15:28:22 +01:00
Unknown W. Brackets ffbd9bbe98 Global: Fix some int/size_t conversion warnings. 2022-03-13 12:03:48 -07:00
Unknown W. Brackets 55c11425e4 softgpu: Use persistent bin task state.
It's constant, so it's better to avoid the copying and allocation.  A
small win, but removes new from the profile.
2022-01-20 16:58:43 -08:00
Unknown W. Brackets dffc333120 softgpu: Avoid thread ordering hazard.
Must run the primitives in the right order.  No shortcutting allowed.
2022-01-13 23:03:42 -08:00
Unknown W. Brackets 7c7340e338 ThreadManager: Check for exchange failure.
Even if expected stays null, since it's weak assume it can fail.
2021-12-07 18:24:01 -08:00
Unknown W. Brackets f9a7ad3e3d ThreadManager: Use separate pool for IO blocking.
This prevents starving the compute pool (which may be used very regularly
parallel loops or other tasks) if the IO operations are slow.
2021-12-05 21:01:49 -08:00
Unknown W. Brackets 8b5173350f ThreadManager: Make TaskType a property of a Task. 2021-12-05 21:01:49 -08:00
Unknown W. Brackets 12b790bb81 ThreadManager: Protect against teardown hang/leak.
Make sure we lock during canceled checks/updates, and also try to free
tasks queued on threads that didn't end up running.
2021-11-27 08:57:19 -08:00
Unknown W. Brackets de9a4dcede ThreadManager: Lock notify on global queue add.
Otherwise, it's possible the chosen thread might not wake up, and then it
may wait for another task to be enqueued - potentially causing a hang.
2021-11-27 08:57:19 -08:00
Unknown W. Brackets d15af6e9d9 ThreadManager: Use atomic task optimistically.
This makes EnqueueTaskOnThread take priority as well.
Gives about 1% improvement in softgpu, reducing overhead a bit.
2021-11-27 08:07:12 -08:00
Henrik Rydgård 0d9d360b07 ThreadManager cleanups 2021-09-08 23:24:00 +02:00
Unknown W. Brackets 8ae3f5eb41 Android: Fix logical CPU count.
Otherwise bad things happen.
2021-06-13 12:47:11 -07:00
Henrik Rydgård 81f0c3a8e4 Address feedback (except the mailbox refcount) 2021-06-13 10:16:53 +02:00
Henrik Rydgård 1d59560409 Make use of hyperthreading for worker threads. Still cap to 16 workers. 2021-06-13 00:05:18 +02:00
Henrik Rydgård 62eadd2dac typo, unnecessary 2021-06-12 23:47:34 +02:00
Henrik Rydgård 2d6a73792b Untested libretro fixes, misc 2021-06-12 23:42:52 +02:00
Henrik Rydgård 0fa27ff9d7 Autodetect number of threads (remove setting). Fix some bugs. 2021-06-12 21:06:59 +02:00
Henrik Rydgård dc94cb8b04 Fix memory leak 2021-06-12 13:03:54 +02:00
Henrik Rydgård a9e9929a72 Change the policy for number of threads 2021-06-12 13:03:54 +02:00
Henrik Rydgård 78f068d7ea Fix a way the threadmanager could get stuck. 2021-06-12 13:03:53 +02:00
Henrik Rydgård 446c2c027e Get rid of the PrioritizedWorkQueue. Instead just queue tasks on the ThreadManager. 2021-06-12 13:03:53 +02:00
Henrik Rydgård 34f8fc557f GameInfoCache: Don't expose the workqueue. Was unused anyway. 2021-06-12 13:03:53 +02:00
Henrik Rydgård 73871b9b7e Implement new thread manager, port stuff to it. 2021-06-12 13:03:53 +02:00