The snippet implements a wrapper for standard F# agent that can be cancelled using the IDisposable interface. This makes it possible to use the agent locally (e.g. inside asynchronous workflow). When it is no longer needed, the agent's body is cancelled.
11 people like thisPosted: 13 years ago by Tomas Petricek
This is an implementation of the Async.Choice combinator that composes a sequence of workflows into one whose result is that of the first workflow that returns a *valid* result. You can think of it as a nondeterministic version of (Seq.tryPick id). This implementation draws ideas from Tomas Petricek's choice implementation in http://fssnip.net/6D. UPDATE (11/2015): Following the discussion in https://fslang.uservoice.com/forums/245727-f-language/suggestions/10575069-add-async-choice-to-fsharp-core I have updated the snippet.
3 people like thisPosted: 12 years ago by Eirik Tsarpalis
Await a wait handle with a cancellation token and optional timeout. Returns a flag indicating whether the handle was signalled, the timeout period elapsed, or the wait was cancelled.
2 people like thisPosted: 10 years ago by Michael Parker
Async.Start with timeout in seconds
3 people like thisPosted: 6 years ago by Tuomas Hietanen
The snippet implements Async.StartCancellable method that can be used to start a given workflow and then cancel it. The cancellation of the workflow is done asynchronously, which means that the caller will wait until the workflow is actually cancelled.
6 people like thisPosted: 12 years ago by Tomas Petricek
A simple implementation that protects the nested workflow from external cancellation. The external cancellation token is passed as an argument for cooperative cancellation. Kudos to Gian Ntzik for this one.
3 people like thisPosted: 11 years ago by Eirik Tsarpalis
The F# Core library offers async.TryFinally which where a synchronous compensation function (of type unit -> unit) is run after an error or cancellation. However, it offers no way to start an asynchronous compensation. The TryFinallyAsync method defined below offers a way around this.
2 people like thisPosted: 9 years ago by Anton Tcholakov