提交 9f95ccb4 编写于 作者: B Brian Anderson

test: Add a crust function stress test

上级 450c4f3f
// This creates a bunch of yielding tasks that run concurrently
// while holding onto C stacks
native mod rustrt {
fn rust_dbg_call(cb: *u8,
data: ctypes::uintptr_t) -> ctypes::uintptr_t;
}
crust fn cb(data: ctypes::uintptr_t) -> ctypes::uintptr_t {
if data == 1u {
data
} else {
task::yield();
count(data - 1u) + count(data - 1u)
}
}
fn count(n: uint) -> uint {
rustrt::rust_dbg_call(cb, n)
}
fn main() {
iter::repeat(100u) {||
task::spawn {||
count(5u);
};
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册