-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
feature requestNew feature or enhancement requestNew feature or enhancement requesttopic: task-exRelated to the proposed new TaskEx library, which should get its own oss havenRelated to the proposed new TaskEx library, which should get its own oss haven
Milestone
Description
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 is useful both within applications, and internally within libraries
Metadata
Metadata
Assignees
Labels
feature requestNew feature or enhancement requestNew feature or enhancement requesttopic: task-exRelated to the proposed new TaskEx library, which should get its own oss havenRelated to the proposed new TaskEx library, which should get its own oss haven