【发布时间】:2021-09-18 17:11:25
【问题描述】:
module Async =
let forever = Async.FromContinuations ignore
let withTimeout timeout action =
async {
let! child = Async.StartChild (action, timeout)
return! child
}
async {
printfn "Started... "
do!
Async.forever
|> Async.withTimeout 1_000
printfn "Finished. "
}
|> Async.RunSynchronously
为什么这段代码没有终止?我希望它在 1000 毫秒后完成。
$ dotnet --version
5.0.103
【问题讨论】:
标签: f#