mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 21:38:01 +03:00
atomic.cpp: improvements.
Reduced static memory amount for waitable atomics. Allow notifier to skip notifications if wait/notify masks don't overlap. Improve raw_notify to wake up the thread by its id, add thread_id arg. Add optional mask argument to notify_one() and notify_all().
This commit is contained in:
parent
b66628baca
commit
5248240e10
7 changed files with 418 additions and 249 deletions
|
@ -1900,14 +1900,15 @@ void thread_base::initialize(void (*error_cb)(), bool(*wait_cb)(const void*))
|
|||
|
||||
void thread_base::notify_abort() noexcept
|
||||
{
|
||||
m_signal.try_inc();
|
||||
u64 tid = m_thread.load();
|
||||
#ifdef _WIN32
|
||||
tid = GetThreadId(reinterpret_cast<HANDLE>(tid));
|
||||
#endif
|
||||
|
||||
while (auto ptr = m_state_notifier.load())
|
||||
{
|
||||
// Since this function is not perfectly implemented, run it in a loop
|
||||
atomic_storage_futex::raw_notify(ptr);
|
||||
|
||||
if (m_state_notifier.load() == ptr)
|
||||
if (atomic_storage_futex::raw_notify(ptr, tid))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue