Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
44c88ddf
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
44c88ddf
编写于
8月 17, 2013
作者:
B
Brian Anderson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
std::rt: Remove an unnecessary allocation from the main sched loop
上级
8fc1d9db
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
11 deletion
+11
-11
src/libstd/rt/task.rs
src/libstd/rt/task.rs
+11
-11
未找到文件。
src/libstd/rt/task.rs
浏览文件 @
44c88ddf
...
...
@@ -59,7 +59,7 @@ pub struct Task {
}
pub
enum
TaskType
{
GreenTask
(
Option
<
~
SchedHome
>
),
GreenTask
(
Option
<
SchedHome
>
),
SchedTask
}
...
...
@@ -173,7 +173,7 @@ pub fn new_root_homed(stack_pool: &mut StackPool,
name
:
None
,
coroutine
:
Some
(
Coroutine
::
new
(
stack_pool
,
stack_size
,
start
)),
sched
:
None
,
task_type
:
GreenTask
(
Some
(
~
home
)),
task_type
:
GreenTask
(
Some
(
home
)),
borrow_list
:
None
}
}
...
...
@@ -196,7 +196,7 @@ pub fn new_child_homed(&mut self,
name
:
None
,
coroutine
:
Some
(
Coroutine
::
new
(
stack_pool
,
stack_size
,
start
)),
sched
:
None
,
task_type
:
GreenTask
(
Some
(
~
home
)),
task_type
:
GreenTask
(
Some
(
home
)),
borrow_list
:
None
}
}
...
...
@@ -204,7 +204,7 @@ pub fn new_child_homed(&mut self,
pub
fn
give_home
(
&
mut
self
,
new_home
:
SchedHome
)
{
match
self
.task_type
{
GreenTask
(
ref
mut
home
)
=>
{
*
home
=
Some
(
~
new_home
);
*
home
=
Some
(
new_home
);
}
SchedTask
=>
{
rtabort!
(
"type error: used SchedTask as GreenTask"
);
...
...
@@ -216,7 +216,7 @@ pub fn take_unwrap_home(&mut self) -> SchedHome {
match
self
.task_type
{
GreenTask
(
ref
mut
home
)
=>
{
let
out
=
home
.take_unwrap
();
return
*
out
;
return
out
;
}
SchedTask
=>
{
rtabort!
(
"type error: used SchedTask as GreenTask"
);
...
...
@@ -275,8 +275,8 @@ pub fn run(&mut self, f: &fn()) {
pub
fn
is_home_no_tls
(
&
self
,
sched
:
&~
Scheduler
)
->
bool
{
match
self
.task_type
{
GreenTask
(
Some
(
~
AnySched
))
=>
{
false
}
GreenTask
(
Some
(
~
Sched
(
SchedHandle
{
sched_id
:
ref
id
,
_
})))
=>
{
GreenTask
(
Some
(
AnySched
))
=>
{
false
}
GreenTask
(
Some
(
Sched
(
SchedHandle
{
sched_id
:
ref
id
,
_
})))
=>
{
*
id
==
sched
.sched_id
()
}
GreenTask
(
None
)
=>
{
...
...
@@ -291,8 +291,8 @@ pub fn is_home_no_tls(&self, sched: &~Scheduler) -> bool {
pub
fn
homed
(
&
self
)
->
bool
{
match
self
.task_type
{
GreenTask
(
Some
(
~
AnySched
))
=>
{
false
}
GreenTask
(
Some
(
~
Sched
(
SchedHandle
{
_
})))
=>
{
true
}
GreenTask
(
Some
(
AnySched
))
=>
{
false
}
GreenTask
(
Some
(
Sched
(
SchedHandle
{
_
})))
=>
{
true
}
GreenTask
(
None
)
=>
{
rtabort!
(
"task without home"
);
}
...
...
@@ -309,11 +309,11 @@ pub fn on_appropriate_sched() -> bool {
let
sched_id
=
task
.sched
.get_ref
()
.sched_id
();
let
sched_run_anything
=
task
.sched
.get_ref
()
.run_anything
;
match
task
.task_type
{
GreenTask
(
Some
(
~
AnySched
))
=>
{
GreenTask
(
Some
(
AnySched
))
=>
{
rtdebug!
(
"anysched task in sched check ****"
);
sched_run_anything
}
GreenTask
(
Some
(
~
Sched
(
SchedHandle
{
sched_id
:
ref
id
,
_
})))
=>
{
GreenTask
(
Some
(
Sched
(
SchedHandle
{
sched_id
:
ref
id
,
_
})))
=>
{
rtdebug!
(
"homed task in sched check ****"
);
*
id
==
sched_id
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录