mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::ctx: Fix invalidation of the promise list head after ready.
ircd::ctx: Fix check for pending on invalidate_futures().
This commit is contained in:
parent
2c3aca9a4a
commit
2c20f0a659
1 changed files with 10 additions and 6 deletions
16
ircd/ctx.cc
16
ircd/ctx.cc
|
@ -2054,6 +2054,7 @@ ircd::ctx::promise_base::make_ready()
|
|||
|
||||
// At this point the promise should no longer be considered valid; no longer
|
||||
// referring to the shared_state.
|
||||
this->st = nullptr;
|
||||
assert(!valid());
|
||||
}
|
||||
|
||||
|
@ -2119,8 +2120,13 @@ ircd::ctx::remove(promise_base &p)
|
|||
promise_base::head(p)
|
||||
};
|
||||
|
||||
if(last == &p && p.next)
|
||||
set_futures_promise(*p.next);
|
||||
if(last == &p)
|
||||
{
|
||||
if(p.next)
|
||||
set_futures_promise(*p.next);
|
||||
else
|
||||
invalidate_futures(p);
|
||||
}
|
||||
|
||||
if(last)
|
||||
for(auto *next{last->next}; next; last = next, next = last->next)
|
||||
|
@ -2190,10 +2196,8 @@ ircd::ctx::set_futures_promise(promise_base &p)
|
|||
};
|
||||
|
||||
for(; next; next = next->next)
|
||||
{
|
||||
assert(is(*next, future_state::PENDING));
|
||||
next->p = std::addressof(p);
|
||||
}
|
||||
if(is(*next, future_state::PENDING))
|
||||
next->p = std::addressof(p);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue