다음을 통해 공유


Async.Start 메서드(F#)

스레드 풀에서 비동기 계산을 시작합니다. 그러나 계산 결과를 기다리지는 않습니다.

네임스페이스/모듈 경로: Microsoft.FSharp.Control

어셈블리: FSharp.Core(FSharp.Core.dll)

// Signature:
static member Start : Async<unit> * ?CancellationToken -> unit

// Usage:
Async.Start (computation)
Async.Start (computation, cancellationToken = cancellationToken)

매개 변수

  • computation
    형식: Async<unit>

    비동기적으로 실행할 계산입니다.

  • cancellationToken
    형식: CancellationToken

    계산과 연결할 취소 토큰입니다. 취소 토큰을 지정하지 않으면 기본 취소 토큰이 사용됩니다.

설명

취소 토큰을 지정하지 않으면 기본 취소 토큰이 사용됩니다.

예제

다음 코드 예제에서는 스레드 풀에서 비동기 계산을 시작하는 방법에 대해 설명합니다.

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)

플랫폼

Windows Windows 서버 2012, Windows Server 2008 R2, Windows 7, 8

버전 정보

F# 코어 라이브러리 버전

지원: 2.0, 4.0, 노트북

참고 항목

참조

Control.Async 클래스(F#)

Microsoft.FSharp.Control 네임스페이스(F#)