summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-27 20:09:02 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commit28c814aa5cfea23e8950ef007916ffc5d089288d (patch)
tree6e8c017c2140e1e7e8d0f3ee584a7f4aee1050f8 /src/pardes.zig
parentc1be5b6b7c11f5dc17fd221c8d01b5693d0ffd0b (diff)
downloadpardes-28c814aa5cfea23e8950ef007916ffc5d089288d.tar.gz
pardes-28c814aa5cfea23e8950ef007916ffc5d089288d.zip
Hold a read that has nothing yet and answer it when its file has news
A following log, event, pty/data or a pty/run before its answer used to answer .again and wait for a wakeAll, which only the parked-write path asked for, so the band-aid had every queue push set turn.parked. Now the core keeps such a read (ctlfs.hold) and, as the turn is given up after anything that queued a record, ran a command out or closed a pane, answers it on its own connection, the way factotum answers the log reads it keeps and acme an event read. Only a read the engine still holds parked is answered, because cloud9 tells the backend nothing of a Tflush, so a flushed read spends no record. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 29a9ab3a..a38eb837 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -72,6 +72,8 @@ pub const Turn = struct {
/// A request that changes a pane was parked for want of quiet.
parked: bool = false,
wake_parked: ?*const fn (?*anyopaque) void = null,
+ /// Answers the reads the core holds, with the turn, as it is given up.
+ answer_held: ?*const fn (?*anyopaque) void = null,
wake_ctx: ?*anyopaque = null,
/// Bumped each time the editor has performed what the core asked of it,
/// so a request that asked for something -- a save, a shell -- can be
@@ -174,6 +176,9 @@ pub const Turn = struct {
}
fn release(t: *Turn) void {
+ // Whatever the holder just did may be what a held read waits for,
+ // and answering it takes the core, so before letting go.
+ if (t.answer_held) |f| f(t.wake_ctx);
const woken = t.out == 0 and t.parked;
if (woken) t.parked = false;
t.mutex.unlock(t.io.?);