]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
d9579d0f | 11 | use alloc::boxed::FnBox; |
1a4d82fc | 12 | use libc; |
c34b1796 | 13 | use sys::stack_overflow; |
1a4d82fc | 14 | |
d9579d0f | 15 | pub unsafe fn start_thread(main: *mut libc::c_void) { |
d9579d0f AL |
16 | // Next, set up our stack overflow handler which may get triggered if we run |
17 | // out of stack. | |
18 | let _handler = stack_overflow::Handler::new(); | |
19 | ||
20 | // Finally, let's run some code. | |
21 | Box::from_raw(main as *mut Box<FnBox()>)() | |
1a4d82fc | 22 | } |