termio: remove data field

This commit is contained in:
Mitchell Hashimoto
2024-07-13 10:42:55 -07:00
parent c4484938c5
commit 4e6e0f90c7

View File

@ -70,9 +70,6 @@ surface_mailbox: apprt.surface.Mailbox,
/// The cached grid size whenever a resize is called. /// The cached grid size whenever a resize is called.
grid_size: renderer.GridSize, grid_size: renderer.GridSize,
/// The data associated with the currently running thread.
data: ?*EventData,
/// The configuration for this IO that is derived from the main /// The configuration for this IO that is derived from the main
/// configuration. This must be exported so that we don't need to /// configuration. This must be exported so that we don't need to
/// pass around Config pointers which makes memory management a pain. /// pass around Config pointers which makes memory management a pain.
@ -194,7 +191,6 @@ pub fn init(alloc: Allocator, opts: termio.Options) !Termio {
.renderer_mailbox = opts.renderer_mailbox, .renderer_mailbox = opts.renderer_mailbox,
.surface_mailbox = opts.surface_mailbox, .surface_mailbox = opts.surface_mailbox,
.grid_size = opts.grid_size, .grid_size = opts.grid_size,
.data = null,
}; };
} }
@ -205,7 +201,6 @@ pub fn deinit(self: *Termio) void {
} }
pub fn threadEnter(self: *Termio, thread: *termio.Thread, data: *ThreadData) !void { pub fn threadEnter(self: *Termio, thread: *termio.Thread, data: *ThreadData) !void {
assert(self.data == null);
const alloc = self.alloc; const alloc = self.alloc;
// Start our subprocess // Start our subprocess
@ -284,10 +279,6 @@ pub fn threadEnter(self: *Termio, thread: *termio.Thread, data: *ThreadData) !vo
}; };
errdefer ev_data_ptr.deinit(self.alloc); errdefer ev_data_ptr.deinit(self.alloc);
// Store our data so our callbacks can access it
self.data = ev_data_ptr;
errdefer self.data = null;
// Start our process watcher // Start our process watcher
process.wait( process.wait(
ev_data_ptr.loop, ev_data_ptr.loop,
@ -341,9 +332,6 @@ fn execFailedInChild(self: *Termio) !void {
} }
pub fn threadExit(self: *Termio, data: *ThreadData) void { pub fn threadExit(self: *Termio, data: *ThreadData) void {
// Clear out our data since we're not active anymore.
self.data = null;
// Stop our reader // Stop our reader
switch (data.reader) { switch (data.reader) {
.manual => {}, .manual => {},