Control.Async Class (F#)
Contains members for creating and manipulating asynchronous computations. Control.Async is a static class.
Namespace/Module Path: Microsoft.FSharp.Control
Assembly: FSharp.Core (in FSharp.Core.dll)
[<Sealed>]
type Async =
class
static member AsBeginEnd : ('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
static member AwaitEvent : IEvent<'Del,'T> * ?(unit -> unit) -> Async<'T>
static member AwaitIAsyncResult : IAsyncResult * ?int -> Async<bool>
static member AwaitTask : Task<'T> -> Async<'T>
static member AwaitWaitHandle : WaitHandle * ?int -> Async<bool>
static member CancelDefaultToken : unit -> unit
static member Catch : Async<'T> -> Async<Choice<'T,exn>>
static member FromBeginEnd : 'Arg1 * 'Arg2 * 'Arg3 * ('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * ?(unit -> unit) -> Async<'T>
static member FromBeginEnd : 'Arg1 * 'Arg2 * ('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * ?(unit -> unit) -> Async<'T>
static member FromBeginEnd : 'Arg1 * ('Arg1 * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * ?(unit -> unit) -> Async<'T>
static member FromBeginEnd : (AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * ?(unit -> unit) -> Async<'T>
static member FromContinuations : (('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
static member Ignore : Async<'T> -> Async<unit>
static member OnCancel : (unit -> unit) -> Async<IDisposable>
static member Parallel : seq<Async<'T>> -> Async<'T []>
static member RunSynchronously : Async<'T> * ?int * ?CancellationToken -> 'T
static member Sleep : int -> Async<unit>
static member Start : Async<unit> * ?CancellationToken -> unit
static member StartAsTask : Async<'T> * ?TaskCreationOptions * ?CancellationToken -> Task<'T>
static member StartChild : Async<'T> * ?int -> Async<Async<'T>>
static member StartChildAsTask : Async<'T> * ?TaskCreationOptions -> Async<Task<'T>>
static member StartImmediate : Async<unit> * ?CancellationToken -> unit
static member StartWithContinuations : Async<'T> * ('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) * ?CancellationToken -> unit
static member SwitchToContext : SynchronizationContext -> Async<unit>
static member SwitchToNewThread : unit -> Async<unit>
static member SwitchToThreadPool : unit -> Async<unit>
static member TryCancelled : Async<'T> * (OperationCanceledException -> unit) -> Async<'T>
static member CancellationToken : Async<CancellationToken>
static member DefaultCancellationToken : CancellationToken
end
Remarks
This type is named FSharpAsync in compiled assemblies. If you are accessing the type from a language other than F#, or through reflection, use this name.
For an overview of asynchronous workflows, see Asynchronous Workflows (F#).
Static Members
Member |
Description |
---|---|
Creates three functions that can be used to implement the .NET Framework Asynchronous Programming Model (APM) for the supplied asynchronous computation. |
|
Creates an asynchronous computation that waits for a single invocation of a .NET Framework event by adding a handler to the event. When the computation finishes or is canceled, the handler is removed from the event. |
|
Creates an asynchronous computation that waits for the supplied IAsyncResult. |
|
Returns an asynchronous computation that waits for the given task to complete and returns its result. |
|
Creates an asynchronous computation that waits for the supplied WaitHandle. |
|
Raises the cancellation condition for the most recent set of asynchronous computations started without any specific CancellationToken. Replaces the global CancellationTokenSource with a new global token source for any asynchronous computations created without any specific CancellationToken. |
|
Creates an asynchronous computation that returns the CancellationToken that manages the execution of the computation. |
|
Creates an asynchronous computation. If this computation finishes successfully, this method returns Choice1Of2 with the returned value. If this computation raises an exception before it finishes, this method returns Choice2Of2 with the raised exception. |
|
Gets the default cancellation token for running asynchronous computations. |
|
Creates an asynchronous computation by specifying a beginning and ending function, like .NET Framework APIs. |
|
Creates an asynchronous computation by specifying a beginning and ending function, like .NET Framework APIs. This overload should be used if the operation is qualified by one argument. |
|
Creates an asynchronous computation by specifying a beginning and ending function, like .NET Framework APIs. This overload should be used if the operation is qualified by two arguments. |
|
Creates an asynchronous computation by specifying a beginning and ending function, like .NET Framework APIs. This overload should be used if the operation is qualified by three arguments. |
|
Creates an asynchronous computation that includes the current success, exception, and cancellation continuations. The callback function must eventually call exactly one of the given continuations. |
|
Creates an asynchronous computation that runs the given computation and ignores its result. |
|
Generates a scoped, cooperative cancellation handler for use within an asynchronous workflow. |
|
Creates an asynchronous computation that runs all the supplied asynchronous computations, initially queuing each as a work item and using a fork/join pattern. |
|
Runs an asynchronous computation and waits for its result. |
|
Creates an asynchronous computation that pauses for the specified time. A Timer object is used to schedule the delay. The operation does not block operating system threads for the duration of the delay. |
|
Starts an asynchronous computation in the thread pool. Does not wait for its result. |
|
Executes a computation in the thread pool. Returns a Task that will be completed in the corresponding state once the computation terminates (produces the result, throws exception or gets canceled) If no cancellation token is provided then the default cancellation token is used. |
|
Starts a child computation within an asynchronous workflow. This allows multiple asynchronous computations to be executed simultaneously. |
|
Creates an asynchronous computation which starts the given computation as a Task. |
|
Runs an asynchronous computation, starting immediately on the current operating system thread. |
|
Runs an asynchronous computation, starting immediately on the current operating system thread. This method calls one of the three continuations when the operation finishes. |
|
Creates an asynchronous computation that runs its continuation by using the Post method of the supplied synchronization context. If the supplied synchronization context is null, the asynchronous computation is equivalent to SwitchToThreadPool. |
|
Creates an asynchronous computation that creates a new thread and runs its continuation in that thread. |
|
Creates an asynchronous computation that queues a work item that runs its continuation. |
|
Creates an asynchronous computation that runs the supplied computation. If this computation is cancelled before it finishes, the computation generated by running the supplied compensation function is executed. |
Platforms
Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2
Version Information
F# Core Library Versions
Supported in: 2.0, 4.0, Portable