Skip to content

Commit

Permalink
use explicit error set for io_uring
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Jul 21, 2023
1 parent 4c3fa55 commit a3e5c9b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/backend/io_uring.zig
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,25 @@ pub const Loop = struct {
}
}

/// The errors that can come from submit. This has to be explicit
/// for now since Zig 0.11 has issues with the inferred error set.
/// We should try again someday.
pub const SubmitError = error{
Unexpected,
SystemResources,
FileDescriptorInvalid,
FileDescriptorInBadState,
CompletionQueueOvercommitted,
SubmissionQueueEntryInvalid,
BufferInvalid,
RingShuttingDown,
OpcodeNotSupported,
SignalInterrupt,
};

/// Submit all queued operations. This never does an io_uring submit
/// and wait operation.
pub fn submit(self: *Loop) !void {
pub fn submit(self: *Loop) SubmitError!void {
_ = try self.ring.submit();

// If we have any submissions that failed to submit, we try to
Expand Down

0 comments on commit a3e5c9b

Please sign in to comment.