Created
April 24, 2014 12:00
-
-
Save vkobel/11252078 to your computer and use it in GitHub Desktop.
F# async simple example. Try it here: http://www.tryfsharp.org/create/vkobel/AsyncSimple.fsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System.Threading | |
let workThenWait() = | |
async { | |
do! Async.Sleep(1000) | |
printfn "work done" | |
} | |
let demo() = | |
printfn "started" | |
let work = workThenWait() |> Async.StartAsTask | |
printfn "completed" | |
work.Wait() | |
demo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment