-
Notifications
You must be signed in to change notification settings - Fork 802
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
Use RunImmediate for better debug stacks #11788
Conversation
@TIHan THis is ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, this should help our stacks a little bit, especially in testing.
Only comment I have is that we have duplicate RunImmediate
implementations; shouldn't we just have one?
I think maybe two will be ok, one for compiler internals and one for all of testing.
@@ -17,6 +18,19 @@ open NUnit.Framework | |||
|
|||
module Utilities = | |||
|
|||
type Async with | |||
static member RunImmediate (computation: Async<'T>, ?cancellationToken ) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we consolidate this one with the default one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default one is not public (not added to FSharp.Core)
I'm sure there was a way to consolidate these a bit - however I couldn't find it immediately. We have one internal in the FSharp.Compiler.Service.dll and one in each test suite. TBH the easiest way to consoldiate is probably to add this method to FSharp.Core |
* Use RunImmediate for better debug stacks * fix build Co-authored-by: Don Syme <[email protected]>
Addresses internal engineering issue #11754
Async.RunSynchronously starts the async on a thread pool thread. There is a suggestion to add Async.RunImmediate that never does this. fsharp/fslang-suggestions#1042. This can be defined in terms of
Async.StartWithContinuations
(which should really be calledAsync.StartImmediateWithContinuations
)This defines and uses Async.RunImmediate internally in our compiler/service implementation and testing since it gives much better synchronous stacks.