Commit Graph

102 Commits

Author SHA1 Message Date
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
Nekotekina b59bb16fad Threads: removed outdated on_abort detection deemed unnecessary
May cause regressions.
2020-02-25 15:48:25 +03:00
Nekotekina 3f943945a7 Threads: Remove unused on_wait() detection to simplify code 2020-02-25 15:36:08 +03:00
Nekotekina 7eebe06931 Restore thread counter (world may be not ready yet)
Remove dumb 1300ms timeout.
2020-02-25 11:51:19 +03:00
Nekotekina 8b4b859091 Remove "thread_ctrl::spawn" 2020-02-23 15:03:38 +03:00
Nekotekina 6a443c0fbd Deprecate thread_ctrl::spawn 2019-10-12 19:14:50 +03:00
plappermaul 925f2ce02f Use Linux timers for sleeps up to 1ms (#6697)
* Use Linux timers for sleeps up to 1ms (v3)
The current sleep timer implementation basically offers two variants. Either
wait the specified time exactly with a condition variable (as host) or use a
combination of it with a thread yielding busy loop afterwards (usleep timer).

While the second one is very precise it consumes CPU loops for each wait call
below 50us. Games like Bomberman Ultra spam 30us waits and the emulator hogs
low power CPUs. Switching to host mode reduces CPU consumption but gives a
~50us penalty for each wait call. Thus extending all sleeps by a factor of
more than two.

The following bugfix tries to improve the system timer for Linux by using
Linux native timers for small wait calls below 1ms. This has two effects.

- Host wait setting has much less wait overhead
- usleep wait setting produces lower CPU overhead
2019-10-09 20:03:34 +03:00
Nekotekina 8031180373 Add dummy alert param to thread_ctrl::wait API 2019-10-06 16:03:10 +03:00
Nekotekina 50fc5dfde5 Use g_fxo for rsx::rsx_replay_thread 2019-09-26 23:26:36 +03:00
Nekotekina 75941e62a8 named_thread: implement default thread name support 2019-09-17 02:46:34 +03:00
Nekotekina c1b0934f72 Simplify thread_base::join()
Use waitable atomics
2019-09-10 19:25:39 +03:00
Nekotekina d13ff285d1 Rewrite `cond_variable` to use waitable atomics
Increase max_timeout and fix max_timeout usage
2019-09-10 19:25:39 +03:00
Nekotekina faba366f89 named_thread: install atomic wait callback 2019-09-10 18:48:46 +03:00
Nekotekina f63e89f9b4 Implement waitable atomics
Moved Atomic.h to util/atomic.hpp
List source files in CMakeLists.txt
2019-07-29 03:04:55 +03:00
Nekotekina 4e4c896136 Expand thread affinity mask to u64
Also fix and note __APPLE__ path.
2019-07-20 15:58:28 +03:00
Nekotekina 1b37e775be Migration to named_thread<>
Add atomic_t<>::try_dec instead of fetch_dec_sat
Add atomic_t<>::try_inc
GDBDebugServer is broken (needs rewrite)
Removed old_thread class (former named_thread)
Removed storing/rethrowing exceptions from thread
Emu.Stop doesn't inject an exception anymore
task_stack helper class removed
thread_base simplified (no shared_from_this)
thread_ctrl::spawn simplified (creates detached thread)
Implemented overrideable thread detaching logic
Disabled cellAdec, cellDmux, cellFsAio
SPUThread renamed to spu_thread
RawSPUThread removed, spu_thread used instead
Disabled deriving from ppu_thread
Partial support for thread renaming
lv2_timer... simplified, screw it
idm/fxm: butchered support for on_stop/on_init
vm: improved allocation structure (added size)
2018-10-19 22:22:35 +03:00
Nekotekina 4bef0f8dab Rename thread_abort (name conflict) 2018-10-02 23:26:54 +03:00
Nekotekina 3359e9a51b Minor thread fixes
Call thread result destructor
2018-10-02 02:22:26 +03:00
Nekotekina 306f95a9ae New named_thread template (preview)
Old class named_thread renamed to old_thread
It's too hard to move in a single commit
2018-09-27 14:04:16 +03:00
Nekotekina a605dd0a3f Add missing deleted operators 2018-09-27 12:16:43 +03:00
Nekotekina c5676e5649 Remove thread_ctrl::atexit
It was only a workaround for poor C++11 thread_local support
2018-09-15 17:09:56 +03:00
Nekotekina 99ffc3fca9 Use std::invoke_result_t
Also simplify idm code
2018-09-08 00:32:04 +03:00
VelocityRa 8981227644 util/thread_ctrl: Method for measuring cycles a thread has run for
Also add a getter for the native thread handle.
2018-05-30 12:35:41 +03:00
kd-11 cbc8bf01a1 cell/scheduler: Manage thread placement depending on cpu hardware 2018-01-19 12:03:57 +03:00
Nekotekina 7d3a528871 Use Qt for error reports 2017-11-23 20:36:21 +03:00
Nekotekina 6561ddae41 PPU LLVM: multithread compilation 2017-06-24 19:12:19 +03:00
kd-11 df7b466656 spu: Speed hacks - Do not starve PPU threads
optionally hint to the OS scheduler to give less attention to SPUs

ui: Add speed 'hacks' as configurable options
2017-05-10 21:50:14 +03:00
Nekotekina 436c245d13 Remove unused code 2017-02-13 18:33:31 +03:00
Nekotekina a5a2d43d7c Thread.cpp refinement
Hide thread mutex
Safe notify() method
Other refactoring
2017-01-29 19:52:19 +03:00
Nekotekina 0f87c4485d Silly macro removed-2 2016-08-14 18:19:42 +03:00
Nekotekina f8719c1230 PPUThread refactoring
`CallbackManager` removed, added _gcm_intr_thread for cellGcmSys
`PPUThread` renamed to `ppu_thread`, inheritance allowed
Added lightweight command queue for `ppu_thread`
Implemented call stack dump for PPU
`get_current_thread_mutex` removed
`thread_ctrl::spawn`: minor initialization fix
`thread_ctrl::wait_for` added
`named_thread`: some methods added
`cpu_thread::run` added
Some bugs fixes, including SPU channels
2016-07-30 16:35:02 +03:00
Nekotekina a026d35c97 sys_interrupt_thread_eoi fixed
thread_ctrl::interrupt improved
BIND_FUNC improved: preparations
2016-07-24 21:06:07 +03:00
Nekotekina 7ccdea7822 Removed std::enable_shared_from_this
Minor ID manager refactoring
2016-07-24 21:06:05 +03:00
Nekotekina 59433bfcd5 Implemented thread_ctrl::interrupt 2016-07-17 02:23:45 +03:00
Nekotekina 266db1336d The rest 2016-05-23 16:22:25 +03:00
Ivan da7472fe81 Optimizations (#1680)
* Optimizations

1) Some headers simplified for better compilation time
2) Some templates simplified for smaller executable size
3) Eliminate std::future to fix compilation for mingw64
4) PKG installation can be cancelled now
5) cellGame fixes
6) XAudio2 fix for mingw64
7) PPUInterpreter bug fixed (Clang)

* any_pod<> implemented

Aliases: any16, any32, any64
rsx::make_command fixed
2016-04-25 13:49:12 +03:00
Nekotekina 250ce63527 Partial commit: Utilities 2016-04-15 19:22:20 +03:00
Nekotekina a666318b95 Error messages improved 2015-12-20 15:41:09 +03:00
Nekotekina ca6783ba9a Threads improved, ID manager improved 2015-12-04 23:37:34 +03:00
Nekotekina a974ee009e vm::var improved, cleanup
Mostly vm::var initialization introduced.
Added vm::make_var function.
2015-10-14 18:17:37 +03:00
Nekotekina 8ae3401ffa Some things improved
shared_mutex_t implemented
GUI Emu Callbacks rewritten
fxm::import, fxm::import_always implemented
cellMsgDialog rewritten
Emu.CallAfter improved (returns std::future)
2015-09-22 16:48:21 +03:00
Nekotekina e551e2bc5d Bugfix 2015-08-24 21:22:49 +03:00
Nekotekina 5e14310071 noexcept usage fixed
thread_t renamed to named_thread_t
2015-08-24 21:22:48 +03:00
Nekotekina d9403c2ed2 thread_t cleanup 2015-08-24 21:22:37 +03:00
Danila Malyutin 009370f73c Fix some compiling problems on OSX
and enable osx builds on travis
2015-08-24 00:20:01 +03:00
Nekotekina 8175630619 sys_cond/sys_mutex improved 2015-07-21 23:14:29 +03:00
Nekotekina a7668ff57f SPU_EVENT_LR improved 2015-07-21 23:14:22 +03:00
Nekotekina 1e021cdbba waiter_map reintroduced, combined with vm 2015-07-21 23:14:20 +03:00
Nekotekina 82781e620a Small fixes 2015-07-10 04:31:36 +03:00