Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TaskEx: Async.startImmediateAsTask #142

Open
bartelink opened this issue Jan 5, 2023 · 0 comments
Open

TaskEx: Async.startImmediateAsTask #142

bartelink opened this issue Jan 5, 2023 · 0 comments
Labels
feature request New feature or enhancement request topic: task-ex Related to the proposed new TaskEx library, which should get its own oss haven
Milestone

Comments

@bartelink
Copy link
Member

Replaces #129. TaskShims top level issue: #139

In contrast to its sibling, Async.StartAsTask (because it is not starting a thread), Async.StartImmediateAsTask does not have a taskCreationOptions optional parameter, so people often use it pipeline expressions.

However, that makes it easy to gloss over the fact that the computation will then not have an ambient cancellation token.

In order to resolve those forces (wanting to be able to execute an async via piping, without the risk of omitting to consider cancelation), it is proposed to have a common helper function (with a lower case name) that

  • takes a cancellation token (as its first argument)
  • passes that and the Async onto Async.StartImmediateAsTask

Current proposed APIs (will be updated inline based on any discussion below):

module Async =
    let inline startImmediateAsTask ct (a : Async<'t>) = Async.StartImmediateAsTask(a, cancellationToken = ct)
   // ALTERNATELY
    let inline executeAsTask ct (a : Async<'t>) = Async.StartImmediateAsTask(a, cancellationToken = ct)

NOTES:

This was referenced Jan 5, 2023
@bartelink bartelink changed the title TaskShims: Async.startImmediateAsTask TaskEx: Async.startImmediateAsTask Jan 10, 2023
@abelbraaksma abelbraaksma added feature request New feature or enhancement request topic: task-ex Related to the proposed new TaskEx library, which should get its own oss haven labels Oct 29, 2023
@abelbraaksma abelbraaksma added this to the vFuture milestone Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or enhancement request topic: task-ex Related to the proposed new TaskEx library, which should get its own oss haven
Projects
None yet
Development

No branches or pull requests

2 participants