mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-01 09:31:25 +00:00
Update libxev to use dynamic backend, support Linux configurability
Related to #3224 Previously, Ghostty used a static API for async event handling: io_uring on Linux, kqueue on macOS. This commit changes the backend to be dynamic on Linux so that epoll will be used if io_uring isn't available, or if the user explicitly chooses it. This introduces a new config `async-backend` (default "auto") which can be set by the user to change the async backend in use. This is a best-effort setting: if the user requests io_uring but it isn't available, Ghostty will fall back to something that is and that choice is up to us. Basic benchmarking both in libxev and Ghostty (vtebench) show no noticeable performance differences introducing the dynamic API, nor choosing epoll over io_uring.
This commit is contained in:
@@ -14,7 +14,7 @@ pub const Thread = @This();
|
||||
const std = @import("std");
|
||||
const ArenaAllocator = std.heap.ArenaAllocator;
|
||||
const builtin = @import("builtin");
|
||||
const xev = @import("xev");
|
||||
const xev = @import("../global.zig").xev;
|
||||
const crash = @import("../crash/main.zig");
|
||||
const termio = @import("../termio.zig");
|
||||
const renderer = @import("../renderer.zig");
|
||||
@@ -189,7 +189,7 @@ pub fn threadMain(self: *Thread, io: *termio.Termio) void {
|
||||
// If our loop is not stopped, then we need to keep running so that
|
||||
// messages are drained and we can wait for the surface to send a stop
|
||||
// message.
|
||||
if (!self.loop.flags.stopped) {
|
||||
if (!self.loop.stopped()) {
|
||||
log.warn("abrupt io thread exit detected, starting xev to drain mailbox", .{});
|
||||
defer log.debug("io thread fully exiting after abnormal failure", .{});
|
||||
self.flags.drain = true;
|
||||
|
||||
Reference in New Issue
Block a user