StrandOptions::aroundTask / KeyedAroundTask<Key> receive a RunTask that wraps a private StrandTask* and exposes only operator(). A hook therefore cannot tell a coroutine resumption from a posted callable.
Why it matters: morph (LASTRADA-Software/morph#806) installs a Task handler's morph::session through the keyed hook. While a handler is suspended, its session reaches every task on that model's key, including onBackendChanged and a queued action until that action installs its own session. morph documents this. A resumption-only session would be tighter.
Proposal: add [[nodiscard]] bool RunTask::isResumption() const noexcept, or a TaskKind enum, so a hook can apply per-resumption context only to coroutine resumptions.
- Cost: none on the path where no hook is set; one load where a hook is set.
- Tests: the hook observes the kind for a
post, a submit(handle) and a submit(ParkedWork).
Not needed for 0.4.x correctness. This is a precision improvement for consumers of the hook.
StrandOptions::aroundTask/KeyedAroundTask<Key>receive aRunTaskthat wraps a privateStrandTask*and exposes onlyoperator(). A hook therefore cannot tell a coroutine resumption from a posted callable.Why it matters: morph (LASTRADA-Software/morph#806) installs a Task handler's
morph::sessionthrough the keyed hook. While a handler is suspended, its session reaches every task on that model's key, includingonBackendChangedand a queued action until that action installs its own session. morph documents this. A resumption-only session would be tighter.Proposal: add
[[nodiscard]] bool RunTask::isResumption() const noexcept, or aTaskKindenum, so a hook can apply per-resumption context only to coroutine resumptions.post, asubmit(handle)and asubmit(ParkedWork).Not needed for 0.4.x correctness. This is a precision improvement for consumers of the hook.