Created
September 23, 2013 21:40
-
-
Save BinRoot/6677361 to your computer and use it in GitHub Desktop.
Ctrl-C Signal Detection in Rust (does not work!)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::libc::c_int; | |
extern { | |
fn signal(sig: c_int, handler: &fn(c_int)); | |
} | |
#[fixed_stack_segment] | |
fn main() { | |
unsafe { signal(2, handle); } | |
loop {} | |
} | |
fn handle(param: c_int) { | |
println("works!"); | |
} | |
// error message is | |
// `fatal runtime error: local malloc outside of task` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment