core-cpp 0.4.1
Added
seal()onStrandandKeyedStrands: close the offer door, keep running what is queued
and what comes back.close()drops the queue, so a teardown of "stop the handlers, drain,
close" dropped whatever arrived between the drain and the close -- a task's finish, a
coroutine's resumption -- and leaked its frame and whatever it was to settle (found by morph's
switch review). Afterseal(),tryPostandtrySubmitreturn false and leave the work with
the caller, forKeyedStrandsfor every key, a key with no strand included.postandsubmit
are still admitted untilclose():submitis how a coroutine the strand already admitted
comes back --ResumeOn,resumeOn(key), anAsyncQueuepush, close or stop -- and dropping it
would free a detached chain without its finish. Queued work runs as usual, and no kept
KeyedStrandsstrand is handed out or kept once sealed.- What a drain can see:
idle()andwaitIdle()then mean nothing queued and nothing
running. A coroutine suspended off the strand -- on a socket, a timer, anAsyncQueue-- is
invisible to both and may still come back, so a consumer counts its own in-flight work. The teardown that loses nothing isseal(), then that
count andwaitIdle()both done (on the single-threaded WebAssembly build, the base run until
they are), thenclose().postis new work too: a producer that posts must stop, or offer
throughtryPost, beforewaitIdle(). - Idempotent;
close()is unchanged. A patch-compatible addition.
- What a drain can see:
Known issues
- MSVC cl 19.51
/O2leaks a coroutine's by-value parameters when its frame is destroyed at
a suspension point with no statement after it
(#54). Keep a statement after the
lastco_awaitin a coroutine that may be destroyed while suspended.
Full Changelog: v0.4.0...v0.4.1