Context-rs
Context utilities in Rust
[]
= "*"
or use the dev version on master
[]
= "https://github.com/zonyitoo/context-rs.git"
Usage
extern crate context;
extern crate libc;
use mem;
use FnBox;
use ;
const STACK_SIZE: usize = 2 * 1024 * 1024; // 2MB
extern "C" !
Use cargo run --example simple
to run this code snippet.
Notices
-
You have to drop the boxed function inside the initialize function!!
-
The resources allocated inside the initialize function must be released before the last context switch.
-
If you context switch inside your callback function, if you decided not to come back, you must release all your resources allocated inside your function.
-
This crate supports platforms in
- arm
- i686
- mips
- mipsel
- x86_64
-
The assembly code is in AT&T-style, so currently it only supports
*-gnu
target on Windows.