Extensions to the F# Microsoft.FSharp.Control.Async module
Extension Members
| Extension Member | Description |
member
AsBeginEnd : computation:Async<'T> ->
(AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) *
(IAsyncResult -> unit) |
Return three functions that can be used to implement the .NET Asynchronous
Programming Model (APM) for a given asynchronous computation.
The functions should normally be published as members with prefix 'Begin',
'End' and 'Cancel', and can be used within a type definition as follows:
let beginAction,endAction,cancelAction = Async.AsBeginEnd computation
member x.BeginSomeOperation(callback,state) = beginAction(callback,state)
member x.EndSomeOperation(iar) = endAction(iar)
member x.CancelSomeOperation(iar) = cancelAction(iar)
The resulting API will be familiar to programmers in other .NET languages and
is a useful way to publish asynchronous computations in .NET components.
|
member
AwaitEvent : IEvent<'Delegate,'T> * ?cancelAction:(unit -> unit) ->
Async<'T> (requires delegate and 'Delegate :> Delegate) |
Return an asynchronous computation that waits for a single invocation of a .NET event by
internally adding a handler to the event. Once the computation completes or is cancelled, the
handler is removed from the event.
The computation will respond to cancellation while waiting for the completion
of the operation. If 'cancelAction' is specified, cancellation causes the given
function to be executed. The computation then continues to wait for the event.
If 'cancelAction' is not specified, then cancellation causes the computation
to stop immediately, and if the event is subsequently raised it may
be ignored.
|
|