Snippets tagged cancellation

  • Cancellable agent

    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 this

    Posted: 12 years ago by Tomas Petricek

  • An implementation of Async.Choice

    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 this

    Posted: 11 years ago by Eirik Tsarpalis

  • Await wait handle with cancellation

    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 this

    Posted: 10 years ago by Michael Parker

  • Async computation with cancellation timeout

    Async.Start with timeout in seconds

    3 people like this

    Posted: 5 years ago by Tuomas Hietanen