Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions Sources/Nimble/Utils/AsyncAwait.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
internal actor AsyncPromise<T> {
private let storage = Storage()

private final class Storage {
private final class Storage: @unchecked Sendable {
private var continuations: [UnsafeContinuation<T, Never>] = []
private var value: T?
// Yes, this is not the fastest lock, but it's platform independent,
Expand Down Expand Up @@ -142,7 +142,8 @@
let semTimedOutOrBlocked = DispatchSemaphore(value: 0)
semTimedOutOrBlocked.signal()

DispatchQueue.main.async {
let timeoutQueue = DispatchQueue(label: "org.quick.nimble.timeoutQueue", qos: .userInteractive)
timeoutQueue.async {
if semTimedOutOrBlocked.wait(timeout: .now()) == .success {
timedOutSem.signal()
semTimedOutOrBlocked.signal()
Expand Down Expand Up @@ -194,7 +195,7 @@
/// - The async expectation raised an unexpected error (swift)
///
/// The returned AsyncPollResult will NEVER be .incomplete.
private func runPoller(

Check warning on line 198 in Sources/Nimble/Utils/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / lint

Function Parameter Count Violation: Function should have 5 parameters or less: it currently has 6 (function_parameter_count)
timeoutInterval: NimbleTimeInterval,
pollInterval: NimbleTimeInterval,
awaiter: Awaiter,
Expand All @@ -202,14 +203,6 @@
sourceLocation: SourceLocation,
expression: @escaping () async throws -> PollStatus
) async -> AsyncPollResult<Bool> {
awaiter.waitLock.acquireWaitingLock(
fnName,
sourceLocation: sourceLocation
)

defer {
awaiter.waitLock.releaseWaitingLock()
}
let timeoutQueue = awaiter.timeoutQueue
return await withTaskGroup(of: AsyncPollResult<Bool>.self) { taskGroup in
taskGroup.addTask {
Expand Down Expand Up @@ -254,7 +247,7 @@
}

// swiftlint:disable:next function_parameter_count
private func runAwaitTrigger<T>(

Check warning on line 250 in Sources/Nimble/Utils/AsyncAwait.swift

View workflow job for this annotation

GitHub Actions / lint

Superfluous Disable Command Violation: SwiftLint rule 'function_parameter_count' did not trigger a violation in the disabled region; remove the disable command (superfluous_disable_command)
awaiter: Awaiter,
timeoutInterval: NimbleTimeInterval,
leeway: NimbleTimeInterval,
Expand Down
Loading