Skip to content

Commit

Permalink
test: Use serial dispatch queue for invocations (#3981)
Browse files Browse the repository at this point in the history
Using the barrier flag with the concurrent attribute is similar to using
a serial dispatch queue, so we can use a serial dispatch queue instead
to simplify the syntax.
  • Loading branch information
philipphofmann authored May 15, 2024
1 parent d914696 commit 9692592
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SentryTestUtils/Invocations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Invocations<T> {

public init() {}

private let queue = DispatchQueue(label: "Invocations", attributes: .concurrent)
private let queue = DispatchQueue(label: "Invocations")

private var _invocations: [T] = []

Expand Down Expand Up @@ -42,13 +42,13 @@ public class Invocations<T> {
}

public func record(_ invocation: T) {
queue.async(flags: .barrier) {
queue.async {
self._invocations.append(invocation)
}
}

public func removeAll() {
queue.async(flags: .barrier) {
queue.async {
self._invocations.removeAll()
}
}
Expand Down

0 comments on commit 9692592

Please sign in to comment.