about summary refs log tree commit diff
path: root/src/test/stdtest
diff options
context:
space:
mode:
authorEric Holk <eholk@mozilla.com>2011-08-17 11:44:35 -0700
committerEric Holk <eholk@mozilla.com>2011-08-17 11:44:50 -0700
commit94260fb91d3e8a11f39eafc1c21bc974713db166 (patch)
treef30b13600c03592562086b75135d036907f712e9 /src/test/stdtest
parent1d7ca9c1897260c30ba236652c2043e670577fe4 (diff)
downloadrust-94260fb91d3e8a11f39eafc1c21bc974713db166.tar.gz
rust-94260fb91d3e8a11f39eafc1c21bc974713db166.zip
Using move-mode for spawn thunks to avoid race conditions.
Diffstat (limited to 'src/test/stdtest')
-rw-r--r--src/test/stdtest/task.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/test/stdtest/task.rs b/src/test/stdtest/task.rs
index c46944bdeb2..6e6c2e0673f 100644
--- a/src/test/stdtest/task.rs
+++ b/src/test/stdtest/task.rs
@@ -8,7 +8,8 @@ fn test_sleep() { task::sleep(1000000u); }
 #[test]
 fn test_unsupervise() {
     fn f() { task::unsupervise(); fail; }
-    task::_spawn(bind f());
+    let foo = f;
+    task::_spawn(foo);
 }
 
 #[test]
@@ -30,7 +31,8 @@ fn test_join() {
 #[test]
 fn test_lib_spawn() {
     fn foo() { log_err "Hello, World!"; }
-    task::_spawn(foo);
+    let f = foo;
+    task::_spawn(f);
 }
 
 #[test]
@@ -44,7 +46,8 @@ fn test_join_chan() {
     fn winner() { }
 
     let p = comm::mk_port::<task::task_notification>();
-    task::spawn_notify(bind winner(), p.mk_chan());
+    let f = winner;
+    task::spawn_notify(f, p.mk_chan());
     let s = p.recv();
     log_err "received task status message";
     log_err s;
@@ -59,7 +62,8 @@ fn test_join_chan_fail() {
     fn failer() { task::unsupervise(); fail }
 
     let p = comm::mk_port::<task::task_notification>();
-    task::spawn_notify(bind failer(), p.mk_chan());
+    let f = failer;
+    task::spawn_notify(f, p.mk_chan());
     let s = p.recv();
     log_err "received task status message";
     log_err s;