我有一个如下的异步计算(见内联注释):
async {
//...
do! Async.Sleep(100) //cancellation may happen during sleep
//... but isn't checked at the end of the sleep, so regular, non-async computations are executed here
}
为了在达到“常规”计算部分之前强制取消检查/终止整个异步计算,我do! Async.Sleep(1)
在do! Async.Sleep(100)
. 有没有更清洁的方法来做到这一点?甚至可能是do! Async.Nop
.