From b0c687ea0e3d7a12782d638439110f00e1334c85 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 7 Apr 2018 03:59:02 -0700 Subject: [PATCH] ircd::ctx: Assertions for calling then(). --- include/ircd/ctx/shared_state.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/ircd/ctx/shared_state.h b/include/ircd/ctx/shared_state.h index e13165ca8..3385b28d4 100644 --- a/include/ircd/ctx/shared_state.h +++ b/include/ircd/ctx/shared_state.h @@ -98,6 +98,7 @@ ircd::ctx::notify(shared_state &st) if(!current) { + assert(bool(st.then)); st.cond.notify_all(); st.then(st); return; @@ -105,6 +106,7 @@ ircd::ctx::notify(shared_state &st) ircd::post([&st] { + assert(bool(st.then)); st.cond.notify_all(); st.then(st); }); @@ -179,6 +181,8 @@ ircd::ctx::state(const shared_state &st) case 0x00: return future_state::INVALID; case 0x42: return future_state::READY; case 0x123: return future_state::RETRIEVED; - default: return future_state::PENDING; + default: + assert(uintptr_t(st.p) >= 0x1000); + return future_state::PENDING; } }