[Home] Type Microsoft.FSharp.Control.Async


This static class holds members for creating and manipulating asynchronous computations

Full Type Signature

[<SealedAttribute ()>]
type Async
with
  static member
    BuildPrimitive : arg1:'arg1 * arg2:'arg2 * arg3:'arg3 *
                     beginAction:('arg1 * 'arg2 * 'arg3 * AsyncCallback * obj -> IAsyncResult) *
                     endAction:(IAsyncResult -> 'res) -> Async<'res>
  static member
    BuildPrimitive : arg1:'arg1 * arg2:'arg2 * beginAction:('arg1 * 'arg2 * AsyncCallback * obj -> IAsyncResult) *
                     endAction:(IAsyncResult -> 'res) -> Async<'res>
  static member
    BuildPrimitive : arg:'arg1 * beginAction:('arg1 * AsyncCallback * obj -> IAsyncResult) *
                     endAction:(IAsyncResult -> 'res) -> Async<'res>
  static member
    BuildPrimitive : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'res) ->
                     Async<'res>
  static member CancelCheck : unit -> Async<unit>
  static member CancelDefaultGroup : ?message:string -> unit
  static member Catch : computation:Async<'res> -> Async<Choice<'res,exn>>
  static member Generate : N:int * generator:(int -> Async<'res>) * ?numGroups:int -> Async<'res array>
  static member OnCancel : f:(string -> unit) -> Async<IDisposable>
  static member Parallel : computationList:seq<Async<'res>> -> Async<'res array>
  static member Parallel2 : computation1:Async<'res> * computation2:Async<'c> -> Async<'res * 'c>
  static member
    Parallel3 : computation1:Async<'res> * computation2:Async<'c> * computation3:Async<'d> ->
                Async<'res * 'c * 'd>
  static member
    Primitive : callBack:(('res -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) ->
                Async<'res>
  static member Primitive : callBack:(('res -> unit) * (exn -> unit) -> unit) -> Async<'res>
  static member Run : computation:Async<'res> * ?timeout:int * ?exitContext:bool -> 'res
  static member
    RunPrimitive : continuation:('res -> unit) * exceptionContinuation:(exn -> unit) *
                   cancellationContinuation:(OperationCanceledException -> unit) -> (Async<'res> -> unit)
  static member Spawn : computation:Async<unit> -> unit
  static member SpawnChild : computation:Async<unit> -> Async<unit>
  static member SpawnFuture : computation:Async<'res> -> AsyncFuture<'res>
  static member SpawnThenPostBack : computation:Async<'res> * postBack:('res -> unit) -> unit
  static member SwitchTo : syncContext:SynchronizationContext -> Async<unit>
  static member SwitchToNewThread : unit -> Async<unit>
  static member SwitchToThreadPool : unit -> Async<unit>
  static member
    WhenCancelled : computation:Async<'res> * postBack:(OperationCanceledException -> unit) -> Async<'res>
  static member DefaultGroup : AsyncGroup
end

Static Members

MemberDescription
member
  BuildPrimitive : arg1:'arg1 * arg2:'arg2 * arg3:'arg3 *
                   beginAction:('arg1 * 'arg2 * 'arg3 * AsyncCallback * obj ->
                                IAsyncResult) * endAction:(IAsyncResult -> 'res)
                   -> Async<'res>
Specify an asynchronous computation in terms of a Begin/End pair of actions in the style used in .NET APIs where the overall operation is qualified by three arguments. For example, Async.BuildPrimitive(arg1,arg2,arg3,ws.BeginGetWeather,ws.EndGetWeather)
member
  BuildPrimitive : arg1:'arg1 * arg2:'arg2 *
                   beginAction:('arg1 * 'arg2 * AsyncCallback * obj ->
                                IAsyncResult) * endAction:(IAsyncResult -> 'res)
                   -> Async<'res>
Specify an asynchronous computation in terms of a Begin/End pair of actions in the style used in .NET APIs where the overall operation is qualified by two arguments. For example, Async.BuildPrimitive(arg1,arg2,ws.BeginGetWeather,ws.EndGetWeather)
member
  BuildPrimitive : arg:'arg1 *
                   beginAction:('arg1 * AsyncCallback * obj -> IAsyncResult) *
                   endAction:(IAsyncResult -> 'res) -> Async<'res>
Specify an asynchronous computation in terms of a Begin/End pair of actions in the style used in .NET APIs where the overall operation is qualified by one argument. For example, Async.BuildPrimitive(place,ws.BeginGetWeather,ws.EndGetWeather)
member
  BuildPrimitive : beginAction:(AsyncCallback * obj -> IAsyncResult) *
                   endAction:(IAsyncResult -> 'res) -> Async<'res>
Specify an asynchronous computation in terms of a Begin/End pair of actions in the style used in .NET APIs where the overall operation is not qualified by any arguments. For example, Async.BuildPrimitive(ws.BeginGetWeather,ws.EndGetWeather)
member CancelCheck : unit -> Async<unit>
Specify an asynchronous computation that checks if the cancellation condition for the AsyncGroup to which this Async computation belongs has been set. If so the operation raises a System.OperationCanceledException.
member CancelDefaultGroup : ?message:string -> unit
Raise the cancellation condition for the most recent set of Async computations started without any specific AsyncGroup. Replace the global group with a new global group for any async computations created after this point without any specific AsyncGroup.
member
  Catch : computation:Async<'res> -> Async<Choice<'res,exn>>
Get the default group for executing asynchronous computations
member DefaultGroup : AsyncGroup
Get the default group for executing asynchronous computations
member
  Generate : N:int * generator:(int -> Async<'res>) * ?numGroups:int ->
             Async<'res array>
Generate asynchronous computations for indexes 0..N-1. Do so in the indicated number of parallel groups, which defaults to the physical processor count on the machine. If any raise an exception attempt to cancel the others.
member OnCancel : f:(string -> unit) -> Async<IDisposable>
Generate a scoped, cooperative cancellation handler for use within an asynchronous workflow. async { use! holder = Async.OnCancel f ... } generates an asynchronous computation where, if a cancellation happens any time during the execution of the asynchronous computation in the scope of 'holder', then action 'f' is executed on the thread that is performing the cancellation. You can use this to arrange for your own computation to be asynchronously notified that a cancellation has occurred, e.g. by setting a flag, or deregistering a pending I/O action.
member
  Parallel : computationList:seq<Async<'res>> ->
             Async<'res array>
Specify an asynchronous computation that, when run, executes all the given asynchronous computations, initially queueing each in the thread pool. If any raise an exception then the overall computation will raise an exception, and attempt to cancel the others. All the sub-computations belong to an AsyncGroup that is a subsidiary of the AsyncGroup of the outer computations.
member
  Parallel2 : computation1:Async<'res> * computation2:Async<'c> ->
              Async<'res * 'c>
Specify an asynchronous computation that, when run, executes the two asynchronous computations, starting each in the thread pool. If any raise an exception then the overall computation will raise an exception, and attempt to cancel the others. All the sub-computations belong to an AsyncGroup that is a subsidiary of the AsyncGroup of the outer computations.
member
  Parallel3 : computation1:Async<'res> * computation2:Async<'c> *
              computation3:Async<'d> -> Async<'res * 'c * 'd>
Specify an asynchronous computation that, when run, executese the three asynchronous computations, starting each in the thread pool. If any raise an exception then the overall computation will raise an exception, and attempt to cancel the others. All the sub-computations belong to an AsyncGroup that is a subsidiary of the AsyncGroup of the outer computations.
member
  Primitive : callBack:(('res -> unit) * (exn -> unit) *
                        (OperationCanceledException -> unit) -> unit) ->
              Async<'res>
Specify an asynchronous computation that, when run, executes the given callback. The callback must eventually call either the continuation, the exception continuation or the cancel exception.
member
  Primitive : callBack:(('res -> unit) * (exn -> unit) -> unit) ->
              Async<'res>
Specify an asynchronous computation that, when run, executes the given callback. The callback must eventually call either the continuation or the exception continuation.
member
  Run : computation:Async<'res> * ?timeout:int * ?exitContext:bool -> 'res
Run the asynchronous computation and await its result. If an exception occurs in the asynchronous computation then an exception is re-raised by this function. Run as part of the default AsyncGroup
member
  RunPrimitive : continuation:('res -> unit) *
                 exceptionContinuation:(exn -> unit) *
                 cancellationContinuation:(OperationCanceledException -> unit)
                 -> (Async<'res> -> unit)
Start the asynchronous computation in the .NET thread pool, initially as a CPU-intensive worker item. Return a handle to the computation as an AsyncFuture. Run as part of the default AsyncGroup
member Spawn : computation:Async<unit> -> unit
Start the asynchronous computation in the thread pool. Do not await its result. Run as part of the default AsyncGroup
member SpawnChild : computation:Async<unit> -> Async<unit>
Start the asynchronous computation in the thread pool, and add it to the AsyncGroup of of the asynchronous computation. Do not await its result. Exceptions in the asynchronous computation are currently ignored.
member SpawnFuture : computation:Async<'res> -> AsyncFuture<'res>
Start the asynchronous computation in the .NET thread pool, initially as a CPU-intensive worker item. Return a handle to the computation as an AsyncFuture. Run as part of the default AsyncGroup
member
  SpawnThenPostBack : computation:Async<'res> * postBack:('res -> unit) ->
                      unit
Start the asynchronous computation in the thread pool. When the result is available execute the given postBack in the synchronization context of the thread that originally called Run. This will frequently be the GUI thread, and in that case the postBack will be executed by sending a 'BeginInvoke' to the GUI message loop. If the System.Threading.SynchronizationContext.Current of the calling thread is 'null' then a FailureException is raised. If an exception occurs in the asynchronous computation then it is posted as a function that raises an exception in the synchronization context of the thread that originally called RunThenPostBack. Run as part of the default AsyncGroup
member SwitchTo : syncContext:SynchronizationContext -> Async<unit>
Specify an asynchronous computation that, when run, runs its continuation using syncContext.Post. If syncContext is null then the asynchronous computation is equivalent to SwitchToThreadPool().
member SwitchToNewThread : unit -> Async<unit>
Specify an asynchronous computation that, when run, creates a new thread and runs its continutation in that thread
member SwitchToThreadPool : unit -> Async<unit>
Specify an asynchronous computation that, when run, queues a CPU-intensive work in the thread pool item that runs its continutation.
member
  WhenCancelled : computation:Async<'res> *
                  postBack:(OperationCanceledException -> unit) ->
                  Async<'res>
Specify an asynchronous computation that, when run, executes computation, If p is effectively cancelled before its termination then the process f exn is executed.

See Also

Microsoft.FSharp.Control


Documentation for assembly FSharp.Core, version 1.9.6.0, generated using F# Programming Language version 1.9.6.0