Skip to content

Commit

Permalink
Bypass a thread-hop by using StartImmediateAsTask
Browse files Browse the repository at this point in the history
  • Loading branch information
abelbraaksma committed Nov 2, 2023
1 parent 32c7a47 commit c175ef1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/FSharp.Control.TaskSeq/AsyncExtensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ module AsyncExtensions =

member _.For(source: TaskSeq<'T>, action: 'T -> Async<unit>) =
source
|> TaskSeq.iterAsync (action >> Async.StartAsTask)
|> TaskSeq.iterAsync (action >> Async.StartImmediateAsTask)
|> Async.AwaitTask
2 changes: 1 addition & 1 deletion src/FSharp.Control.TaskSeq/TaskSeqBuilder.fs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ module HighPriority =
ResumableTSC<'U>(fun sm ->
let mutable awaiter =
Async
.StartAsTask(computation, cancellationToken = sm.Data.cancellationToken)
.StartImmediateAsTask(computation, cancellationToken = sm.Data.cancellationToken)
.GetAwaiter()

let mutable __stack_fin = true
Expand Down

0 comments on commit c175ef1

Please sign in to comment.