목록withTaskGroup (1)
기어가더라도 제대로

Operation struct SlowDivideOperation { let name: String let a: Double let b: Double let sleepDuration: UInt64 func execute() async -> Double { do { // Sleep for x seconds try await Task.sleep(nanoseconds: sleepDuration * 1_000_000_000) let value = a / b return value } catch { return 0.0 } } } let operations = [ SlowDivideOperation(name: "operation-0", a: 5, b: 1, sleepDuration: 5), SlowDivideOpe..
Swift - 더 나아가기
2023. 2. 2. 18:32