日記
今日書いたコード
感想
"ここ"が呼ばれるまでwithThrowingTaskGroupがスタックしてそうで詰まっている。
// [https://github.com/Gurrium/ReadGraphemeCluster/commit/d009232e69d957413022f07ae7df1e8710e93da8#diff-102f0c74b4bceb38182a3d1f4823344c81ab3d0d92662ce8f740d1f595889185R154] withThrowingTaskGroup { taskGroup in for try await scalar in fileHandle.bytes.unicodeScalars { if Task.isCancelled { return nil // ここ } // ... } // ... taskGroup.cancelAll() // ... }
こうあるのでcancelAll()
を呼べばいいと思うんだが…
A group waits for all of its child tasks to complete, throw an error, or be canceled before it returns https://developer.apple.com/documentation/swift/withthrowingtaskgroup(of:returning:body:)#discussion
飽きたので終わり。