Async.Start Method (F#)
Visual Studio 2012
Starts the asynchronous computation in the thread pool. Do not await its result.
Namespace/Module Path: Microsoft.FSharp.Control
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature: static member Start : Async<unit> * ?CancellationToken -> unit // Usage: Async.Start (computation) Async.Start (computation, cancellationToken = cancellationToken)
The following code example shows how to start an asynchronous computation on the thread pool.
open System.Windows.Forms let bufferData = Array.zeroCreate<byte> 100000000 let async1 = async { use outputFile = System.IO.File.Create("longoutput.dat") do! outputFile.AsyncWrite(bufferData) } let form = new Form(Text = "Test Form") let button = new Button(Text = "Start") form.Controls.Add(button) button.Click.Add(fun args -> Async.Start(async1)) Application.Run(form)