I do not see that error. Which toolchain are you compiling from? I can compile from 6.2 and the 6.3 RC with no errors. I do see a 6.4 error… but this is answered from the other thread:
Does anyone have advice for defining or passing an isolated and synchronous closure that should also be Sendable? Suppose I start with an actor. I need to perform some work with withTaskCancellationHandler. I begin an operation and run a handler if this task is cancelled. actor A { func operation() { } func handler() { } func f1() async { await withTaskCancellationHandler( operation: self.operation, onCancel: self.handler ) } } This compiles wit…
If you wanted to ship a legit CountedTask in a real product I think it would just need to copy over the different flavors of Task constructors and then forward those parameters to its task variable.