input: crash binding can configure which thread to crash

This commit is contained in:
Mitchell Hashimoto
2024-09-01 21:00:12 -07:00
parent 8f477b00da
commit d499f7795b
6 changed files with 45 additions and 7 deletions

View File

@@ -270,6 +270,8 @@ fn drainMailbox(self: *Thread) !void {
while (self.mailbox.pop()) |message| {
log.debug("mailbox message={}", .{message});
switch (message) {
.crash => @panic("crash request, crashing intentionally"),
.visible => |v| {
// Set our visible state
self.flags.visible = v;

View File

@@ -8,6 +8,10 @@ const terminal = @import("../terminal/main.zig");
/// The messages that can be sent to a renderer thread.
pub const Message = union(enum) {
/// Purposely crash the renderer. This is used for testing and debugging.
/// See the "crash" binding action.
crash: void,
/// A change in state in the window focus that this renderer is
/// rendering within. This is only sent when a change is detected so
/// the renderer is expected to handle all of these.