Skip to content
Prev Previous commit
Next Next commit
Changed EnqueueWorkAndWait to just EnqueueWork that's not blocking
  • Loading branch information
TIHan committed May 25, 2019
commit fb8ecf79c26e20c3b659106c63dcb119108ee70a
6 changes: 3 additions & 3 deletions src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,7 @@ type ResolvedExtensionReference = ResolvedExtensionReference of string * Assembl

type ITypeProviderThread =

abstract EnqueueWorkAndWait: (unit -> 'T) -> 'T
abstract EnqueueWork: (unit -> unit) -> unit
#endif

type ImportedBinary =
Expand Down Expand Up @@ -2278,7 +2278,7 @@ type TcConfigBuilder =
continueAfterParseFailure = false
#if !NO_EXTENSIONTYPING
showExtensionTypeMessages = false
typeProviderThread = { new ITypeProviderThread with member __.EnqueueWorkAndWait work = work () }
typeProviderThread = { new ITypeProviderThread with member __.EnqueueWork work = work () }
#endif
pause = false
alwaysCallVirt = true
Expand Down Expand Up @@ -3815,7 +3815,7 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
let actions = disposeTypeProviderActions
disposeTypeProviderActions <- []
if actions.Length > 0 then
typeProviderThread.EnqueueWorkAndWait (fun () -> for action in actions do action())
typeProviderThread.EnqueueWork (fun () -> for action in actions do action())
#endif
let actions = disposeActions
disposeActions <- []
Expand Down
3 changes: 1 addition & 2 deletions src/fsharp/CompileOps.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,7 @@ type ResolvedExtensionReference = ResolvedExtensionReference of string * Assembl
type ITypeProviderThread =

/// Enqueue work to be done on the type provider thread.
/// This is a synchronous call.
abstract EnqueueWorkAndWait: (unit -> 'T) -> 'T
abstract EnqueueWork: (unit -> unit) -> unit
#endif

[<RequireQualifiedAccess>]
Expand Down
9 changes: 4 additions & 5 deletions src/fsharp/service/IncrementalBuild.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1752,11 +1752,10 @@ type IncrementalBuilder(tcGlobals, frameworkTcImports, nonFrameworkAssemblyInput
#if !NO_EXTENSIONTYPING
tcConfigB.typeProviderThread <-
{ new ITypeProviderThread with
member __.EnqueueWorkAndWait work =
Reactor.Singleton.EnqueueAndAwaitOpAsync ("Unknown", "ITypeProvider.EnqueueWorkAndWait", "work", fun _ ->
// not cancellable
Cancellable.ret (work ())
) |> Async.RunSynchronously
member __.EnqueueWork work =
Reactor.Singleton.EnqueueOp ("Unknown", "ITypeProvider.EnqueueWorkAndWait", "work", fun _ ->
work ()
)
}
#endif

Expand Down