Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Fix some sendability warnings in tests
Motivation:

Swift concurrency warnings are here to help.
We can encode some of our assumptions to the type system.

Modifications:

Replace a number of captured variables with LoopBound instances.

Result:

Fewer sendability warnings
  • Loading branch information
PeterAdams-A committed Aug 11, 2023
commit 75a94977712707ed1bd66738b5b015f63f9f05b5
2 changes: 1 addition & 1 deletion Sources/NIOSSHPerformanceTester/Benchmark.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protocol Benchmark: AnyObject {
func run() throws -> Int
}

func measureAndPrint<B: Benchmark>(desc: String, benchmark bench: B) throws {
@MainActor func measureAndPrint<B: Benchmark>(desc: String, benchmark bench: B) throws {
try bench.setUp()
defer {
bench.tearDown()
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIOSSHPerformanceTester/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public func measure(_ fn: () throws -> Int) rethrows -> [TimeInterval] {

let limitSet = CommandLine.arguments.dropFirst()

public func measureAndPrint(desc: String, fn: () throws -> Int) rethrows {
@MainActor public func measureAndPrint(desc: String, fn: () throws -> Int) rethrows {
if limitSet.count == 0 || limitSet.contains(desc) {
print("measuring\(warning): \(desc): ", terminator: "")
let measurements = try measure(fn)
Expand Down
Loading