Avatar
Avatar
kntk
@swift-5.10.1 @swift-6.0-dev actor Counter { var count = 0 func increment() { count += 1 } func incrementCounters(c: isolated Counter) async { for _ in 0..<1_000 { await self.increment() c.increment() } } } let c1 = Counter() let c2 = Counter() let t1 = Task.detached { await c1.incrementCounters(c: c2) } let t2 = Task.detached { await c2.incrementCounters(c: c1) } await (t1.value, t2.value) await print(c1.count, c2.count)
swift510 BOT 5/3/2024 9:44 AM
2000 2000<stdin>:19:7: warning: expression of type '((), ())' is unused await (t1.value, t2.value) ^~~~~~~~~~~~~~~~~~~~