mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-30 15:02:42 +02:00
Improve deferral management logic, to fix order-sensitive bug
This commit is contained in:
parent
f9d38856f3
commit
de4c2ddae1
@ -182,7 +182,9 @@ class WaitableManager : public SessionManagerBase {
|
|||||||
/* We finished processing, and maybe that means we can stop deferring an object. */
|
/* We finished processing, and maybe that means we can stop deferring an object. */
|
||||||
{
|
{
|
||||||
std::scoped_lock lk{this_ptr->deferred_lock};
|
std::scoped_lock lk{this_ptr->deferred_lock};
|
||||||
|
bool undeferred_any = true;
|
||||||
|
while (undeferred_any) {
|
||||||
|
undeferred_any = false;
|
||||||
for (auto it = this_ptr->deferred_waitables.begin(); it != this_ptr->deferred_waitables.end();) {
|
for (auto it = this_ptr->deferred_waitables.begin(); it != this_ptr->deferred_waitables.end();) {
|
||||||
auto w = *it;
|
auto w = *it;
|
||||||
Result rc = w->HandleDeferred();
|
Result rc = w->HandleDeferred();
|
||||||
@ -195,6 +197,7 @@ class WaitableManager : public SessionManagerBase {
|
|||||||
} else {
|
} else {
|
||||||
/* Add to the waitables list. */
|
/* Add to the waitables list. */
|
||||||
this_ptr->AddWaitable(w);
|
this_ptr->AddWaitable(w);
|
||||||
|
undeferred_any = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Move on to the next deferred waitable. */
|
/* Move on to the next deferred waitable. */
|
||||||
@ -204,6 +207,7 @@ class WaitableManager : public SessionManagerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IWaitable *GetWaitable() {
|
IWaitable *GetWaitable() {
|
||||||
std::scoped_lock lk{this->process_lock};
|
std::scoped_lock lk{this->process_lock};
|
||||||
|
Loading…
Reference in New Issue
Block a user