1 // Copyright 2013 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.
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.
14 #[allow(non_camel_case_types)] // runtime type
15 type raw_thread = libc::c_void;
19 raw_thread: *raw_thread,
24 pub fn start(main: ~fn()) -> Thread {
25 fn substart(main: &~fn()) -> *raw_thread {
26 unsafe { rust_raw_thread_start(main) }
28 let raw = substart(&main);
37 assert!(!self.joined);
39 unsafe { rust_raw_thread_join(this.raw_thread); }
44 impl Drop for Thread {
47 unsafe { rust_raw_thread_delete(self.raw_thread) }
52 pub fn rust_raw_thread_start(f: &(~fn())) -> *raw_thread;
53 pub fn rust_raw_thread_join(thread: *raw_thread);
54 pub fn rust_raw_thread_delete(thread: *raw_thread);