Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
91af6e8d
F
fsharp
项目概览
dotNET Platform
/
fsharp
11 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
91af6e8d
编写于
10月 22, 2020
作者:
W
Will Smith
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removing reactor changes
上级
ffcbdea4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
1 addition
and
30 deletion
+1
-30
src/fsharp/service/Reactor.fs
src/fsharp/service/Reactor.fs
+1
-26
src/fsharp/service/Reactor.fsi
src/fsharp/service/Reactor.fsi
+0
-4
未找到文件。
src/fsharp/service/Reactor.fs
浏览文件 @
91af6e8d
...
...
@@ -43,17 +43,6 @@ type Reactor() =
let
mutable
bgOpCts
=
new
CancellationTokenSource
()
let
threadsUsed
=
System
.
Collections
.
Concurrent
.
ConcurrentDictionary
<
int
,
byte
>()
let
useThread
(
thread
:
Thread
)
=
thread
.
CurrentUICulture
<-
culture
threadsUsed
.[
thread
.
ManagedThreadId
]
<-
0
uy
{
new
IDisposable
with
member
_.
Dispose
()
=
let
res
,
_
=
threadsUsed
.
TryRemove
(
thread
.
ManagedThreadId
)
assert
res
}
/// Mailbox dispatch function.
let
builder
=
MailboxProcessor
<_>.
Start
<|
fun
inbox
->
...
...
@@ -80,9 +69,7 @@ type Reactor() =
Trace
.
TraceInformation
(
"Reactor: {0:n3} pausing {1} milliseconds"
,
DateTime
.
Now
.
TimeOfDay
.
TotalSeconds
,
pauseBeforeBackgroundWork
)
pauseBeforeBackgroundWork
return
!
inbox
.
TryReceive
(
timeout
)
}
use
_
disposable
=
useThread
Thread
.
CurrentThread
Thread
.
CurrentThread
.
CurrentUICulture
<-
culture
match
msg
with
|
Some
(
SetBackgroundOp
bgOpOpt
)
->
//Trace.TraceInformation("Reactor: --> set background op, remaining {0}", inbox.CurrentQueueLength)
...
...
@@ -211,18 +198,6 @@ type Reactor() =
return
!
resultCell
.
AsyncResult
}
member
r
.
ExecuteOrEnqueueAndAwaitOpAsync
(
userOpName
,
opName
,
opArg
,
f
)
=
if
threadsUsed
.
ContainsKey
(
Thread
.
CurrentThread
.
ManagedThreadId
)
then
async
{
let
!
ct
=
Async
.
CancellationToken
let
result
=
match
Cancellable
.
run
ct
(
f
(
AssumeCompilationThreadWithoutEvidence
()
))
with
|
ValueOrCancelled
.
Value
r
->
r
|
ValueOrCancelled
.
Cancelled
e
->
raise
e
return
result
}
else
r
.
EnqueueAndAwaitOpAsync
(
userOpName
,
opName
,
opArg
,
f
)
member
__.
PauseBeforeBackgroundWork
with
get
()
=
pauseBeforeBackgroundWork
and
set
v
=
pauseBeforeBackgroundWork
<-
v
static
member
Singleton
=
theReactor
...
...
src/fsharp/service/Reactor.fsi
浏览文件 @
91af6e8d
...
...
@@ -48,10 +48,6 @@ type internal Reactor =
/// Put the operation in the queue, and return an async handle to its result.
member
EnqueueAndAwaitOpAsync
:
userOpName
:
string
*
opName
:
string
*
opArg
:
string
*
(
CompilationThreadToken
->
Cancellable
<
'
T
>)
->
Async
<
'
T
>
/// 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.
/// This prevents a deadlock.
member
ExecuteOrEnqueueAndAwaitOpAsync
:
userOpName
:
string
*
opName
:
string
*
opArg
:
string
*
(
CompilationThreadToken
->
Cancellable
<
'
T
>)
->
Async
<
'
T
>
/// The timespan in milliseconds before background work begins after the operations queue is empty
member
PauseBeforeBackgroundWork
:
int
with
get
,
set
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录