From 2f91217c90d9efc02f4d1bd28a7e2188b774bf77 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 16 Apr 2025 23:44:21 +0000 Subject: [PATCH] Fix a few things I missed --- Sources/System/IORing.swift | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Sources/System/IORing.swift b/Sources/System/IORing.swift index 3ef9299..e45d48a 100644 --- a/Sources/System/IORing.swift +++ b/Sources/System/IORing.swift @@ -437,14 +437,18 @@ public struct IORing: ~Copyable { extraArgs: UnsafeMutablePointer? = nil ) throws(OperationError) -> IOCompletion { var result: IOCompletion? = nil - try _blockingConsumeCompletionGuts(minimumCount: 1, maximumCount: 1, extraArgs: extraArgs) { - (completion: consuming IOCompletion?, error, done) in - if let error { - throw error - } - if let completion { - result = consume completion + do { + try _blockingConsumeCompletionGuts(minimumCount: 1, maximumCount: 1, extraArgs: extraArgs) { + (completion: consuming IOCompletion?, error, done) in + if let error { + throw error + } + if let completion { + result = consume completion + } } + } catch (let e) { + throw e as! OperationError //TODO: why is this needed? } return result.take()! } @@ -459,7 +463,7 @@ public struct IORing: ~Copyable { ) var err: OperationError? = nil var result: IOCompletion? = nil - result = try withUnsafePointer(to: &ts) { tsPtr in + result = withUnsafePointer(to: &ts) { tsPtr in var args = io_uring_getevents_arg( sigmask: 0, sigmask_sz: 0, @@ -469,7 +473,7 @@ public struct IORing: ~Copyable { do { return try _blockingConsumeOneCompletion(extraArgs: &args) } catch (let e) { - err = e as! OperationError + err = (e as! OperationError) return nil } } @@ -505,7 +509,7 @@ public struct IORing: ~Copyable { minimumCount: minimumCount, maximumCount: UInt32.max, extraArgs: &args, consumer: consumer) } catch (let e) { - err = e as! Err //TODO: why is `e` coming in as `any Error`? That seems wrong + err = (e as! Err) //TODO: why is `e` coming in as `any Error`? That seems wrong } } if let err { @@ -692,10 +696,10 @@ public struct IORing: ~Copyable { for req in linkedRequests.dropLast() { var raw = req.makeRawRequest() raw.linkToNextRequest() - _writeRequest( + _ = _writeRequest( raw, ring: &submissionRing, submissionQueueEntries: submissionQueueEntries) } - _writeRequest( + _ = _writeRequest( last.makeRawRequest(), ring: &submissionRing, submissionQueueEntries: submissionQueueEntries) }