0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-13 16:33:53 +01:00

ircd::ctx: Fix future_state test grate.

This commit is contained in:
Jason Volk 2018-07-06 16:33:53 -07:00
parent 712b343017
commit 668d12bf72

View file

@ -163,7 +163,25 @@ bool
ircd::ctx::is(const shared_state<T> &st,
const future_state &state_)
{
return state(st) == state_;
switch(st.st)
{
case future_state::READY:
case future_state::OBSERVED:
case future_state::RETRIEVED:
return state_ == st.st;
default: switch(state_)
{
case future_state::INVALID:
return st.p == nullptr;
case future_state::PENDING:
return uintptr_t(st.p) >= 0x1000;
default:
return false;
}
}
}
/// Internal; get the current state of the shared_state; safe but unnecessary