-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Labels
Description
Here is a simple program using TaskBuilder:
open System.Threading
open System.Threading.Tasks
open ExtCore.Control.Tasks
[<EntryPoint>]
let main _ =
let completed = ref false
let t = tasks {
printfn "Started"
let n = ref 10
let s = ref 0
printfn "Next while"
while 0 < !n do
printfn "Iteration"
s := !n + !s
n := !n - 1
printfn "Sum %A" !s
lock completed <| fun () ->
completed := true
Monitor.PulseAll completed
}
t.Start ()
lock completed <| fun () ->
while not !completed do
Monitor.Wait completed |> ignore
0Running this program (Mono, but I don't expect different behavior under .Net) I get the following output:
Started
Next while
After which nothing happens. I would expect the computation to run to completion. Like when happens if you replace tasks with async and t.Start () with Async.Start t.
Reactions are currently unavailable