Skip to content

Commit

Permalink
Simplify fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ffried committed Sep 24, 2024
1 parent 2e701cd commit 05723be
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Sources/FileStreamer/FileStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,15 @@ extension FileStream {
onElement elementCallback: @escaping _ElementCallback,
onFailure failureCallback: @escaping (any Error) -> ()) -> SendableDispatchSource {
#if swift(>=6.0)
func send(_ value: sending Element, _: isolated (any Actor)? = #isolation) {
elementCallback(value)
}
#else
let unsafeCallback = unsafeBitCast(elementCallback, to: ((Element) -> ()).self)
#endif
func send(_ value: Element) {
#if swift(>=6.0)
unsafeCallback(value)
#else
elementCallback(value)
}
#endif
}

let workerQueue = DispatchQueue(label: "de.sersoft.filestreamer.filestream.gcd.worker")
let source = DispatchSource.makeReadSource(fileDescriptor: fileDesc.rawValue, queue: workerQueue)
Expand Down

0 comments on commit 05723be

Please sign in to comment.