Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
514fc308
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,发现更多精彩内容 >>
提交
514fc308
编写于
5月 14, 2014
作者:
B
Brian Anderson
提交者:
Alex Crichton
5月 15, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
std: Remove run_in_bare_thread
上级
b05af1f6
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
23 addition
and
54 deletion
+23
-54
src/libgreen/sched.rs
src/libgreen/sched.rs
+3
-3
src/librustuv/lib.rs
src/librustuv/lib.rs
+3
-3
src/librustuv/uvio.rs
src/librustuv/uvio.rs
+3
-3
src/libstd/rt/local.rs
src/libstd/rt/local.rs
+11
-11
src/libstd/unstable/mod.rs
src/libstd/unstable/mod.rs
+0
-31
src/test/run-pass/foreign-call-no-runtime.rs
src/test/run-pass/foreign-call-no-runtime.rs
+3
-3
未找到文件。
src/libgreen/sched.rs
浏览文件 @
514fc308
...
...
@@ -1137,11 +1137,11 @@ fn test_home_sched() {
fn
test_schedule_home_states
()
{
use
sleeper_list
::
SleeperList
;
use
super
::{
Shutdown
,
Scheduler
,
SchedHandle
};
use
std
::
unstable
::
run_in_bare_t
hread
;
use
std
::
unstable
::
T
hread
;
use
std
::
rt
::
thread
::
Thread
;
use
std
::
sync
::
deque
::
BufferPool
;
run_in_bare_thread
(
proc
()
{
Thread
::
start
(
proc
()
{
let
sleepers
=
SleeperList
::
new
();
let
mut
pool
=
BufferPool
::
new
();
let
(
normal_worker
,
normal_stealer
)
=
pool
.deque
();
...
...
@@ -1260,7 +1260,7 @@ fn run(next: Box<GreenTask>) {
normal_thread
.join
();
special_thread
.join
();
});
})
.join
()
;
}
//#[test]
...
...
src/librustuv/lib.rs
浏览文件 @
514fc308
...
...
@@ -472,7 +472,7 @@ fn local_loop() -> &'static mut uvio::UvIoFactory {
#[cfg(test)]
mod
test
{
use
std
::
mem
::
transmute
;
use
std
::
unstable
::
run_in_bare_t
hread
;
use
std
::
rt
::
T
hread
;
use
super
::{
slice_to_uv_buf
,
Loop
};
...
...
@@ -496,10 +496,10 @@ fn test_slice_to_uv_buf() {
#[test]
fn
loop_smoke_test
()
{
run_in_bare_thread
(
proc
()
{
Thread
::
start
(
proc
()
{
let
mut
loop_
=
Loop
::
new
();
loop_
.run
();
loop_
.close
();
});
})
.join
()
;
}
}
src/librustuv/uvio.rs
浏览文件 @
514fc308
...
...
@@ -27,7 +27,7 @@
use
std
::
rt
::
rtio
::{
ProcessConfig
,
IoFactory
,
EventLoop
};
use
ai
=
std
::
io
::
net
::
addrinfo
;
#[cfg(test)]
use
std
::
unstable
::
run_in_bare_t
hread
;
#[cfg(test)]
use
std
::
rt
::
T
hread
;
use
super
::{
uv_error_to_io_error
,
Loop
};
...
...
@@ -116,7 +116,7 @@ fn has_active_io(&self) -> bool {
#[test]
fn
test_callback_run_once
()
{
run_in_bare_thread
(
proc
()
{
Thread
::
start
(
proc
()
{
let
mut
event_loop
=
UvEventLoop
::
new
();
let
mut
count
=
0
;
let
count_ptr
:
*
mut
int
=
&
mut
count
;
...
...
@@ -125,7 +125,7 @@ fn test_callback_run_once() {
});
event_loop
.run
();
assert_eq!
(
count
,
1
);
});
})
.join
()
;
}
pub
struct
UvIoFactory
{
...
...
src/libstd/rt/local.rs
浏览文件 @
514fc308
...
...
@@ -53,24 +53,24 @@ unsafe fn try_unsafe_borrow() -> Option<*mut Task> {
#[cfg(test)]
mod
test
{
use
option
::{
None
,
Option
};
use
unstable
::
run_in_bare_t
hread
;
use
rt
::
thread
::
T
hread
;
use
super
::
*
;
use
owned
::
Box
;
use
rt
::
task
::
Task
;
#[test]
fn
thread_local_task_smoke_test
()
{
run_in_bare_thread
(
proc
()
{
Thread
::
start
(
proc
()
{
let
task
=
box
Task
::
new
();
Local
::
put
(
task
);
let
task
:
Box
<
Task
>
=
Local
::
take
();
cleanup_task
(
task
);
});
})
.join
()
;
}
#[test]
fn
thread_local_task_two_instances
()
{
run_in_bare_thread
(
proc
()
{
Thread
::
start
(
proc
()
{
let
task
=
box
Task
::
new
();
Local
::
put
(
task
);
let
task
:
Box
<
Task
>
=
Local
::
take
();
...
...
@@ -79,12 +79,12 @@ fn thread_local_task_two_instances() {
Local
::
put
(
task
);
let
task
:
Box
<
Task
>
=
Local
::
take
();
cleanup_task
(
task
);
});
})
.join
()
;
}
#[test]
fn
borrow_smoke_test
()
{
run_in_bare_thread
(
proc
()
{
Thread
::
start
(
proc
()
{
let
task
=
box
Task
::
new
();
Local
::
put
(
task
);
...
...
@@ -93,12 +93,12 @@ fn borrow_smoke_test() {
}
let
task
:
Box
<
Task
>
=
Local
::
take
();
cleanup_task
(
task
);
});
})
.join
()
;
}
#[test]
fn
borrow_with_return
()
{
run_in_bare_thread
(
proc
()
{
Thread
::
start
(
proc
()
{
let
task
=
box
Task
::
new
();
Local
::
put
(
task
);
...
...
@@ -108,12 +108,12 @@ fn borrow_with_return() {
let
task
:
Box
<
Task
>
=
Local
::
take
();
cleanup_task
(
task
);
});
})
.join
()
;
}
#[test]
fn
try_take
()
{
run_in_bare_thread
(
proc
()
{
Thread
::
start
(
proc
()
{
let
task
=
box
Task
::
new
();
Local
::
put
(
task
);
...
...
@@ -122,7 +122,7 @@ fn try_take() {
assert
!
(
u
.is_none
());
cleanup_task
(
t
);
});
})
.join
()
;
}
fn
cleanup_task
(
mut
t
:
Box
<
Task
>
)
{
...
...
src/libstd/unstable/mod.rs
浏览文件 @
514fc308
...
...
@@ -11,7 +11,6 @@
#![doc(hidden)]
use
libc
::
uintptr_t
;
use
kinds
::
Send
;
pub
use
core
::
finally
;
...
...
@@ -21,36 +20,6 @@
pub
mod
sync
;
pub
mod
mutex
;
/**
Start a new thread outside of the current runtime context and wait
for it to terminate.
The executing thread has no access to a task pointer and will be using
a normal large stack.
*/
pub
fn
run_in_bare_thread
(
f
:
proc
():
Send
)
{
use
rt
::
thread
::
Thread
;
Thread
::
start
(
f
)
.join
()
}
#[test]
fn
test_run_in_bare_thread
()
{
let
i
=
100
;
run_in_bare_thread
(
proc
()
{
assert_eq!
(
i
,
100
);
});
}
#[test]
fn
test_run_in_bare_thread_exchange
()
{
// Does the exchange heap work without the runtime?
let
i
=
box
100
;
run_in_bare_thread
(
proc
()
{
assert
!
(
i
==
box
100
);
});
}
/// Dynamically inquire about whether we're running under V.
/// You should usually not use this unless your test definitely
/// can't run correctly un-altered. Valgrind is there to help
...
...
src/test/run-pass/foreign-call-no-runtime.rs
浏览文件 @
514fc308
...
...
@@ -11,7 +11,7 @@
extern
crate
libc
;
use
std
::
mem
;
use
std
::
unstable
::
run_in_bare_t
hread
;
use
std
::
rt
::
thread
::
T
hread
;
#[link(name
=
"rustrt"
)]
extern
{
...
...
@@ -21,10 +21,10 @@ fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t),
pub
fn
main
()
{
unsafe
{
run_in_bare_thread
(
proc
()
{
Thread
::
start
(
proc
()
{
let
i
=
&
100
;
rust_dbg_call
(
callback
,
mem
::
transmute
(
i
));
});
})
.join
()
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录