Answer a live intervention only after it has run
The kickoff thread moved the posted task out before running it, so the waiting command could read the outcome too early and refuse a substitution or tactic change (without a reason) that was then applied anyway. The task stays posted until it has finished. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
dcc572082a
commit
fee03624be
1 file changed
+3
-1
@@ -9884,7 +9884,9 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
r->changed.wait(lock, [r] { return r->finish || r->remaining > 0 || bool(r->task); });
|
r->changed.wait(lock, [r] { return r->finish || r->remaining > 0 || bool(r->task); });
|
||||||
if (!r->task) break;
|
if (!r->task) break;
|
||||||
auto task = std::move(r->task);
|
// the task stays posted until it has run: the waiting command reads its outcome
|
||||||
|
// only after `task` is cleared below (a moved-from function would look done at once)
|
||||||
|
const auto task = r->task;
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
task();
|
task();
|
||||||
lock.lock();
|
lock.lock();
|
||||||
|
|||||||
Reference in new issue
Block a user