]> git.proxmox.com Git - rustc.git/blame - src/libstd/sys/common/thread.rs
New upstream version 1.13.0+dfsg1
[rustc.git] / src / libstd / sys / common / thread.rs
CommitLineData
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 11use alloc::boxed::FnBox;
1a4d82fc 12use libc;
c34b1796 13use sys::stack_overflow;
1a4d82fc 14
d9579d0f 15pub 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}