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
4f85b8b2ef
Threading: Remove a level of indirection from Promise and Mailbox.
...
Makes using small copyable or POD objects in these more efficient, and if you want
to you can just put a pointer or smart pointer in there, which will
effectively do the same thing as the old setup.
2021-11-20 22:40:10 +01:00
Unknown W. Brackets
e21f2b8fcf
Common: UWP buildfix.
...
Just use SetThreadDescription() directly, assuming new enough Windows.
2021-11-13 09:40:07 -08:00
Henrik Rydgård
9f1c9b9963
Buildfix
2021-11-13 18:12:09 +01:00
Henrik Rydgård
6e1455fd55
Use the "new" API SetThreadDescription to set thread names on Windows.
...
Mainly useful in debugging and profiling tools. Using the new function helps
modern debugging/profiling tools like Superluminal which don't support the
old exception method.
(Is there any old tool left that might be a reason we'd want to do both?)
2021-11-13 18:02:36 +01:00
Unknown W. Brackets
3ac669f80b
Core: Fix some minor gcc warnings.
2021-09-13 08:13:14 -07:00
Henrik Rydgård
0d9d360b07
ThreadManager cleanups
2021-09-08 23:24:00 +02:00
Jan Beich
ae39923223
Thread: set names on BSDs after 062566b67c
2021-08-10 16:44:44 +00:00
Jan Beich
5b7557acd4
Thread: unbreak on BSDs after 50d9d7ea6f
...
Common/Thread/ThreadUtil.cpp:149:2: error: use of undeclared identifier 'pthread_threadid_np'
pthread_threadid_np(NULL, &tid);
^
2021-08-10 16:44:41 +00:00
Stuart Kenny
96454fcbb6
Revert removal of Teardown call
...
As per review recommendation.
2021-07-08 15:39:51 +01:00
Stuart Kenny
02a24cdb7d
Fix black screen on multiple libretro content loads.
...
Moves ThreadPool teardown to retro_unload_game. Gives ThreadPool threads some breathing room to terminate before game load starts spamming it with tasks.
2021-07-08 08:34:48 +01:00
Henrik Rydgård
15a2373f04
Implement thread debug id with the syscall instead of gettid().
...
See #14545
2021-06-21 01:27:17 +02:00
Henrik Rydgård
692a54ea74
An attempt at cleaning up the checks in ThreadUtil
2021-06-19 14:54:36 +02:00
Henrik Rydgård
c92775d26b
Try a slightly rougher fix for libretro builds
...
(our builds work, but not their CI)
2021-06-14 22:44:27 +02:00
Henrik Rydgård
727b84ce5e
Possible fix for reported problem with gettid() in libretro
2021-06-14 18:07:24 +02:00
Unknown W. Brackets
8ae3f5eb41
Android: Fix logical CPU count.
...
Otherwise bad things happen.
2021-06-13 12:47:11 -07:00
Unknown W. Brackets
cdcd77a931
Core: Correct relocation error check.
2021-06-13 10:51:51 -07:00
Henrik Rydgård
6d634f0c96
Mailbox: Address feedback
2021-06-13 11:27:12 +02: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
ac9cc26a6d
Simplifiy WaitableCounter. Fixes it on Mac/ARM.
...
Not completely sure why it didn't work before...
2021-06-12 23:08:07 +02:00
Henrik Rydgård
50d9d7ea6f
Unittest buildfixes on mac
2021-06-12 22:42:10 +02:00
Henrik Rydgård
5b64a41a97
ParallelLoop: A bit smarter straggler handling.
2021-06-12 22:04:55 +02:00
Henrik Rydgård
3be5c7bd9a
Make the minimum items per thread explicit. Found some bugs, optional arguments are evil.
2021-06-12 21:21:28 +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
5fd15c06a3
Code cleanup
2021-06-12 13:03:54 +02:00
Henrik Rydgård
0f6a90098b
Remove experimental unused stuff.
2021-06-12 13:03:53 +02:00
Henrik Rydgård
06663c478d
Rename setCurrentThreadName to SetCurrentThreadName
2021-06-12 13:03:53 +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
Henrik Rydgård
f4a6d291e1
Common: Capitalize setCurrentThreadName().
2021-04-30 23:02:36 -07:00
Henrik Rydgård
e6aa841b78
Common: Get rid of Executor.cpp/h.
...
There was only one implementation.
2021-04-30 22:33:34 -07:00
Unknown W. Brackets
4f96169357
Core: Init memory on multiple threads.
...
Also init volatile at the same time for consistency.
2021-04-16 00:53:50 -07:00
Unknown W. Brackets
b2f3f06768
Common: Set a min size on threadpool work chunks.
...
This should avoid slicing loops, etc. into too many chunks. Generalize
the memcpy a bit.
2021-04-15 23:59:02 -07:00
Unknown W. Brackets
639dd67130
Common: Allow threadpool size up to 16.
...
In Config, we allow 16, so this just matches that.
2021-04-15 23:56:34 -07:00
Henrik Rydgård
15382d5f94
Move threading utils from native to Common
2020-10-01 09:27:25 +02:00