libfringe/examples/basic.rs
2015-04-15 19:35:27 -04:00

20 lines
323 B
Rust

#![feature(thread_local)]
extern crate lwkt;
use lwkt::Context;
#[thread_local]
static mut ctx_slot: *mut Context = 0 as *mut Context;
fn main() {
unsafe {
let mut ctx = Context::new(move || {
println!("it's alive!");
(*ctx_slot).swap();
});
ctx_slot = &mut ctx;
(*ctx_slot).swap();
}
}