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

@@ -268,6 +268,7 @@ fn drainMailbox(
log.debug("mailbox message={}", .{message});
switch (message) {
.crash => @panic("crash request, crashing intentionally"),
.change_config => |config| {
defer config.alloc.destroy(config.ptr);
try io.changeConfig(data, config.ptr);

View File

@@ -29,6 +29,10 @@ pub const Message = union(enum) {
padding: renderer.Padding,
};
/// Purposely crash the renderer. This is used for testing and debugging.
/// See the "crash" binding action.
crash: void,
/// The derived configuration to update the implementation with. This
/// is allocated via the allocator and is expected to be freed when done.
change_config: struct {