mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12:00
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)
This commit is contained in:
parent
8ca6c9fff0
commit
1b37e775be
82 changed files with 1820 additions and 2023 deletions
|
@ -1023,7 +1023,7 @@ public:
|
|||
}
|
||||
|
||||
// Conditionally decrement
|
||||
simple_type fetch_dec_sat(simple_type greater_than = std::numeric_limits<simple_type>::min(), simple_type amount = 1)
|
||||
bool try_dec(simple_type greater_than = std::numeric_limits<simple_type>::min())
|
||||
{
|
||||
type _new, old = atomic_storage<type>::load(m_data);
|
||||
|
||||
|
@ -1031,17 +1031,39 @@ public:
|
|||
{
|
||||
_new = old;
|
||||
|
||||
if (_new <= greater_than)
|
||||
if (!(_new > greater_than))
|
||||
{
|
||||
// Early exit
|
||||
return old;
|
||||
return false;
|
||||
}
|
||||
|
||||
_new -= amount;
|
||||
_new -= 1;
|
||||
|
||||
if (LIKELY(atomic_storage<type>::compare_exchange(m_data, old, _new)))
|
||||
{
|
||||
return old;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Conditionally increment
|
||||
bool try_inc(simple_type less_than = std::numeric_limits<simple_type>::max())
|
||||
{
|
||||
type _new, old = atomic_storage<type>::load(m_data);
|
||||
|
||||
while (true)
|
||||
{
|
||||
_new = old;
|
||||
|
||||
if (!(_new < less_than))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_new += 1;
|
||||
|
||||
if (LIKELY(atomic_storage<type>::compare_exchange(m_data, old, _new)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue