summary refs log tree commit diff
path: root/src/libstd/sys/common/thread.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2015-04-01 11:12:30 -0400
committerNiko Matsakis <niko@alum.mit.edu>2015-04-01 14:41:21 -0400
commitcade32acf6f5ff209ee082d70350d9bc0362985a (patch)
tree79c4fd475c0b8e9f75972eb505800399025fba06 /src/libstd/sys/common/thread.rs
parented63d32651105e56afceb94cbb86f115db235825 (diff)
downloadrust-cade32acf6f5ff209ee082d70350d9bc0362985a.tar.gz
rust-cade32acf6f5ff209ee082d70350d9bc0362985a.zip
Remove `Thunk` struct and `Invoke` trait; change `Thunk` to be an alias
for `Box<FnBox()>`. I found the alias was still handy because it is
shorter than the fully written type.

This is a [breaking-change]: convert code using `Invoke` to use `FnBox`,
which is usually pretty straight-forward. Code using thunk mostly works
if you change `Thunk::new => Box::new` and `foo.invoke(arg)` to
`foo(arg)`.
Diffstat (limited to 'src/libstd/sys/common/thread.rs')
-rw-r--r--src/libstd/sys/common/thread.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/sys/common/thread.rs b/src/libstd/sys/common/thread.rs
index f45daea18a2..1845b6266ed 100644
--- a/src/libstd/sys/common/thread.rs
+++ b/src/libstd/sys/common/thread.rs
@@ -25,6 +25,7 @@ pub fn start_thread(main: *mut libc::c_void) {
     unsafe {
         stack::record_os_managed_stack_bounds(0, usize::MAX);
         let _handler = stack_overflow::Handler::new();
-        Box::from_raw(main as *mut Thunk).invoke(());
+        let main: Box<Thunk> = Box::from_raw(main as *mut Thunk);
+        main();
     }
 }