// RUN: %target-run-simple-swift( -Xfrontend -sil-verify-all -target %target-swift-5.1-abi-triple %import-libdispatch -parse-as-library) // REQUIRES: executable_test // REQUIRES: concurrency // REQUIRES: libdispatch // rdar://76038845 // REQUIRES: concurrency_runtime // UNSUPPORTED: back_deployment_runtime @available(SwiftStdlib 5.1, *) actor Counter { private var value = 0 private let scratchBuffer: UnsafeMutableBufferPointer init(maxCount: Int) { scratchBuffer = .allocate(capacity: maxCount) scratchBuffer.initialize(repeating: 0) } func next() -> Int { let current = value // Make sure we haven't produced this value before assert(scratchBuffer[current] == 0) scratchBuffer[current] = 1 value = value + 1 return current } deinit { for i in 0..] = [] for i in 0..= 2 ? Int(args[1])! : 10 let workers = args.count >= 3 ? Int(args[2])! : 100 let iterations = args.count >= 4 ? Int(args[3])! : 1000 print("counters: \(counters), workers: \(workers), iterations: \(iterations)") await runTest(numCounters: counters, numWorkers: workers, numIterations: iterations) } }