mirror of
https://github.com/apple/swift-system
synced 2026-11-28 05:14:33 +00:00
More refactoring, and working timeout support on ManagedIORing
This commit is contained in:
1 parent
ef94a37193
commit
7ea32aefce
7 files changed
+208
-39
No files matched your search
@@ -21,8 +21,7 @@ public struct AsyncFileDescriptor: ~Copyable {
|
||||
let cstr = path.withCString {
|
||||
return $0 // bad
|
||||
}
|
||||
let res = await ring.submitAndWait(
|
||||
IORequest(
|
||||
let res = try await ring.submit(request: IORequest(
|
||||
opening: cstr,
|
||||
in: directory,
|
||||
into: fileSlot,
|
||||
@@ -46,7 +45,7 @@ public struct AsyncFileDescriptor: ~Copyable {
|
||||
|
||||
@inlinable @inline(__always)
|
||||
public consuming func close(isolation actor: isolated (any Actor)? = #isolation) async throws {
|
||||
let res = await ring.submitAndWait(IORequest(closing: fileSlot))
|
||||
let res = try await ring.submit(request: IORequest(closing: fileSlot))
|
||||
if res.result < 0 {
|
||||
throw Errno(rawValue: -res.result)
|
||||
}
|
||||
@@ -59,8 +58,7 @@ public struct AsyncFileDescriptor: ~Copyable {
|
||||
atAbsoluteOffset offset: UInt64 = UInt64.max,
|
||||
isolation actor: isolated (any Actor)? = #isolation
|
||||
) async throws -> UInt32 {
|
||||
let res = await ring.submitAndWait(
|
||||
IORequest(
|
||||
let res = try await ring.submit(request: IORequest(
|
||||
reading: fileSlot,
|
||||
into: buffer,
|
||||
at: offset
|
||||
@@ -78,8 +76,7 @@ public struct AsyncFileDescriptor: ~Copyable {
|
||||
atAbsoluteOffset offset: UInt64 = UInt64.max,
|
||||
isolation actor: isolated (any Actor)? = #isolation
|
||||
) async throws -> UInt32 {
|
||||
let res = await ring.submitAndWait(
|
||||
IORequest(
|
||||
let res = try await ring.submit(request: IORequest(
|
||||
reading: fileSlot,
|
||||
into: buffer,
|
||||
at: offset
|
||||
|
||||
Reference in new issue
Block a user