1
0
Fork 0

move os::Stack behind the facade, to OsStack

This commit is contained in:
edef 2015-04-16 07:44:07 -04:00
parent ff25697444
commit fe490275fa
3 changed files with 7 additions and 5 deletions

View File

@ -5,12 +5,12 @@ extern crate test;
extern crate lwkt; extern crate lwkt;
use lwkt::Context; use lwkt::Context;
static mut ctx_slot: *mut Context<'static, lwkt::os::Stack> = 0 as *mut Context<_>; static mut ctx_slot: *mut Context<'static, lwkt::OsStack> = 0 as *mut Context<_>;
#[bench] #[bench]
fn swap(b: &mut test::Bencher) { fn swap(b: &mut test::Bencher) {
unsafe { unsafe {
let stack = lwkt::os::Stack::new(4 << 20).unwrap(); let stack = lwkt::OsStack::new(4 << 20).unwrap();
let mut ctx = Context::new(stack, move || { let mut ctx = Context::new(stack, move || {
let ctx_ptr = ctx_slot; let ctx_ptr = ctx_slot;

View File

@ -3,11 +3,11 @@ extern crate lwkt;
use lwkt::Context; use lwkt::Context;
#[thread_local] #[thread_local]
static mut ctx_slot: *mut Context<'static, lwkt::os::Stack> = 0 as *mut Context<_>; static mut ctx_slot: *mut Context<'static, lwkt::OsStack> = 0 as *mut Context<_>;
fn main() { fn main() {
unsafe { unsafe {
let stack = lwkt::os::Stack::new(4 << 20).unwrap(); let stack = lwkt::OsStack::new(4 << 20).unwrap();
let mut ctx = Context::new(stack, move || { let mut ctx = Context::new(stack, move || {
println!("it's alive!"); println!("it's alive!");

View File

@ -14,6 +14,8 @@ extern crate std;
pub use context::Context; pub use context::Context;
pub use stack::Stack; pub use stack::Stack;
#[cfg(feature = "os")]
pub use os::Stack as OsStack;
#[cfg(not(test))] #[cfg(not(test))]
mod std { pub use core::*; } mod std { pub use core::*; }
@ -26,4 +28,4 @@ mod debug;
mod arch; mod arch;
#[cfg(feature = "os")] #[cfg(feature = "os")]
pub mod os; mod os;