Commit Graph

150 Commits

Author SHA1 Message Date
Eladash 4f76211551 Hotfix #10411 2021-06-08 20:12:32 +03:00
Eladash 76bf720adf Improve emulation stopping speed
Split phases of signalling threads and joining them.
2021-06-08 18:26:14 +03:00
Eladash daa53b77cf Simplify named_thread construction 2021-05-01 18:08:03 +03:00
Nekotekina 61450335a5 named_thread: use concepts, improve constructors
Better default thread name detection.
2021-04-21 17:19:53 +03:00
Nekotekina 0c9c481cee Use requires syntax in more places
Change style in some places.
2021-04-19 16:51:40 +03:00
Megamouse a16d8ba3ea More random changes 2021-04-11 14:01:51 +03:00
Nekotekina 3609eb25c9 Implement thread_ctrl::is_main() 2021-03-06 23:10:31 +03:00
Nekotekina 55c75d2c87 Implement thread_ctrl::get_tid() 2021-03-06 23:10:31 +03:00
Nekotekina bbf52f3cea named_thread: fix bugs in std::forward usage
Fix few misused threads and other bugs.
2021-03-02 16:08:14 +03:00
Nekotekina de9d859f4a named_thread: implement task queue
atomic_ptr: implement push_head()

thread_ctrl::state() triggers task queue execution.
2021-02-28 20:20:17 +03:00
Nekotekina 3aaa0172d5 named_thread: implement "default" event loop
Fixup "sleepy" thread at startup on Windows.
Permit threads which lack operator()() overload.
2021-02-28 20:16:13 +03:00
Nekotekina 29e7eda887 named_thread: rewrite result_storage
Use SFINAE as permitted by std::invoke_result_t<>
2021-02-28 20:16:13 +03:00
Nekotekina ee288340b0 Implement thread_ctrl::scoped_priority
RAII priority control (+1, or -1)
2021-01-25 21:49:16 +03:00
Eladash 12e1be2626 Implement thread_ctrl::wait_on (see #9208) 2021-01-21 18:31:51 +03:00
RipleyTom bef2c50b03 Remove bom in Utilities dir 2020-12-25 10:07:40 +03:00
Nekotekina fb29933d3d Add usz alias for std::size_t 2020-12-18 12:23:53 +03:00
Nekotekina 6b3f722ff0 Hotfix: useless error 2020-12-16 11:57:29 +03:00
Nekotekina b59f142d4e Move types.h to util/types.hpp 2020-12-12 15:12:01 +03:00
Nekotekina b382d3b3e9 Remove ASSUME macro
It's dangerous and sometimes bluntly misused feature.
Its optimization potential is near-zero.
2020-12-10 14:08:02 +03:00
Nekotekina 36c8654fb8 Remove HERE macro
Some cleanup.
Add location to some functions.
2020-12-10 12:30:22 +03:00
Nekotekina b5d498ffda Homebrew atomic_ptr rewritten (util/shared_ptr.hpp)
It's analogous to C++20 atomic std::shared_ptr

The following things brought into global namespace:
single_ptr
shared_ptr
atomic_ptr
make_single
2020-11-26 20:11:26 +03:00
Nekotekina d4c17ecda5 Simplify communication with thread pool
Add "entry_point" member to "thread_base".
Don't use "m_thread" to exchange values.
2020-11-23 11:32:34 +03:00
Nekotekina 71f1021648 Fix thread pool entry point and get_cycles()
Fix possible race between thread handle availability.
Don't treat zero thread as invalid one.
Now entry point is full is assembly.
Attempt to fix #9282
Also fix some TLS.
2020-11-21 17:18:42 +03:00
Nekotekina d789250976 Add thread_ctrl::get_thread_stack
Returns addr and size of current thread's stack.
2020-11-17 05:33:46 +03:00
Nekotekina badb3dc2dd atomic.cpp/threads: remove old wait callback
Add new wait callback which simply collects statistics.
Shift workarounds towards actual problem detection.
2020-11-14 18:16:27 +03:00
Nekotekina 0c7f9458c0 Fix thread pool resource management.
Make sure no tail call happens (change ret address to a trampoline).
Make sure thread handles don't leak if the pool is full.
2020-11-13 17:17:45 +03:00
Nekotekina ab365fe494 Fixed thread pool a bit
Use 128-bit allocator instead of queue.
When pool is full (128), threads just terminate as before.
2020-11-13 13:32:44 +03:00
Nekotekina 67785a918c Implement simple thread pool 2020-11-13 03:32:24 +03:00
Megamouse a3eb5c2d63 More Header cleanup 2020-11-06 22:14:05 +01:00
Nekotekina 34fa010601 Improve cond_var notifiers
But nobody uses it anyway, so clean up includes.
2020-11-06 00:10:16 +03:00
Nekotekina 10caa2981f Improve raw_notify a bit 2020-10-24 14:16:32 +03:00
Eladash fe9c61fe73 atomic.hpp: Fix atomic_storage_futex::raw_notify 2020-09-12 22:11:40 +03:00
RipleyTom 10820fa135
Implement sceNpSignaling & signaling improvements (#8836) 2020-09-07 22:50:17 +01:00
Eladash a029a94c73 SPU: Use waitable atomics for SPU channels interface 2020-07-23 13:45:58 +03:00
Nekotekina f6200ba635 Implement thread_ctrl::get_process_affinity_mask() 2020-05-01 22:00:56 +03:00
Nekotekina 76294beae1 Implement thread_ctrl::get_thread_affinity_mask() 2020-04-29 00:09:40 +03:00
Nekotekina aae338a91c named_thread_group: add a default constructor 2020-03-28 17:17:51 +03:00
Nekotekina 49d8731c1c Thread.h: fix warning 2020-03-21 13:49:41 +03:00
Nekotekina c577bd2111 Implement thread_state::errored
State after calling thread emergency_exit() function.
Also default-construct thread result in this case.
2020-03-20 21:31:27 +03:00
Nekotekina 04dedb17eb Disable exception handling.
Use -fno-exceptions in cmake.
On MSVC, enable _HAS_EXCEPTION=0.
Cleanup throw/catch from the source.
Create yaml.cpp enclave because it needs exception to work.
Disable thread_local optimizations in logs.cpp (TODO).
Implement cpu_counter for cpu_threads (moved globals).
2020-03-12 16:03:08 +03:00
Nekotekina 07e1766a7c Implement thread_ctrl::emergency_exit()
Replace exception throws with this.
2020-03-08 15:11:02 +03:00
Nekotekina 8d847d6f1c Thread: internal cleanup
Use different, simpler algorithm in wait_for.
Although the very idea of such notifications was rotten.
2020-03-03 20:26:37 +03:00
Nekotekina d594490329 Thread: removed unused wait() with predicate.
It doesn't work this way anyway.
2020-03-03 18:33:02 +03:00
Nekotekina 6c66153372 Threads: move linux m_timer to static thread_local variable
Allows lazy allocation of the timer handle.
2020-03-03 18:33:02 +03:00
Nekotekina f72971f19f Implement named_thread_group 2020-02-29 16:55:25 +03:00
Nekotekina 799c3f9708 Remove global thread counter (again)
Seems fine without it now.
2020-02-28 21:50:19 +03:00
Nekotekina 490f58ff3c Try to purge thread_state::detached
It's rarely necessary, but can cause unexpected problems.
2020-02-28 21:11:13 +03:00
Nekotekina 65eeee0f4c Remove cancerous lf_value<>
Replace thread names (generic, PPU, SPU) with new shared pointers.
Devirtualize cpu_thread::get_name (used in single case).
2020-02-28 18:54:46 +03:00
Nekotekina a0d2bc9769 named_thread: allow default constructor only with thread_name
In C++20, lambdas may be default-constructible allowing nasty stuff.
2020-02-26 21:23:30 +03:00
Nekotekina b083edccd3 Threads: remove some unused code (remnants from thread spawn) 2020-02-25 15:57:57 +03:00