summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
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.?);