Skip to content

Commit 91af6e8

Browse files
committed
Removing reactor changes
1 parent ffcbdea commit 91af6e8

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

src/fsharp/service/Reactor.fs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,6 @@ type Reactor() =
4343

4444
let mutable bgOpCts = new CancellationTokenSource()
4545

46-
let threadsUsed = System.Collections.Concurrent.ConcurrentDictionary<int, byte>()
47-
48-
let useThread (thread: Thread) =
49-
thread.CurrentUICulture <- culture
50-
threadsUsed.[thread.ManagedThreadId] <- 0uy
51-
{ new IDisposable with
52-
member _.Dispose() =
53-
let res, _ = threadsUsed.TryRemove(thread.ManagedThreadId)
54-
assert res
55-
}
56-
5746
/// Mailbox dispatch function.
5847
let builder =
5948
MailboxProcessor<_>.Start <| fun inbox ->
@@ -80,9 +69,7 @@ type Reactor() =
8069
Trace.TraceInformation("Reactor: {0:n3} pausing {1} milliseconds", DateTime.Now.TimeOfDay.TotalSeconds, pauseBeforeBackgroundWork)
8170
pauseBeforeBackgroundWork
8271
return! inbox.TryReceive(timeout) }
83-
84-
use _disposable = useThread Thread.CurrentThread
85-
72+
Thread.CurrentThread.CurrentUICulture <- culture
8673
match msg with
8774
| Some (SetBackgroundOp bgOpOpt) ->
8875
//Trace.TraceInformation("Reactor: --> set background op, remaining {0}", inbox.CurrentQueueLength)
@@ -211,18 +198,6 @@ type Reactor() =
211198
return! resultCell.AsyncResult
212199
}
213200

214-
member r.ExecuteOrEnqueueAndAwaitOpAsync (userOpName, opName, opArg, f) =
215-
if threadsUsed.ContainsKey(Thread.CurrentThread.ManagedThreadId) then
216-
async {
217-
let! ct = Async.CancellationToken
218-
let result =
219-
match Cancellable.run ct (f (AssumeCompilationThreadWithoutEvidence())) with
220-
| ValueOrCancelled.Value r -> r
221-
| ValueOrCancelled.Cancelled e -> raise e
222-
return result }
223-
else
224-
r.EnqueueAndAwaitOpAsync(userOpName, opName, opArg, f)
225-
226201
member __.PauseBeforeBackgroundWork with get() = pauseBeforeBackgroundWork and set v = pauseBeforeBackgroundWork <- v
227202

228203
static member Singleton = theReactor

src/fsharp/service/Reactor.fsi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ type internal Reactor =
4848
/// Put the operation in the queue, and return an async handle to its result.
4949
member EnqueueAndAwaitOpAsync : userOpName:string * opName:string * opArg:string * (CompilationThreadToken -> Cancellable<'T>) -> Async<'T>
5050

51-
/// Put the operation in the queue or run it immediately if the op is trying to be executed on the thread that is currently being used in the reactor.
52-
/// This prevents a deadlock.
53-
member ExecuteOrEnqueueAndAwaitOpAsync : userOpName:string * opName:string * opArg:string * (CompilationThreadToken -> Cancellable<'T>) -> Async<'T>
54-
5551
/// The timespan in milliseconds before background work begins after the operations queue is empty
5652
member PauseBeforeBackgroundWork : int with get, set
5753

0 commit comments

Comments
 (0)