diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2013-06-15 20:15:52 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2013-06-16 12:47:36 -0400 |
| commit | e7b0b71197bb246c3213914919bdb959f39a8f74 (patch) | |
| tree | eec16ae22197e1b165db106b7b4d6fbb4757cdfd /src/libstd/task/spawn.rs | |
| parent | eb48c296817be7529a1757ac8d4798112717eaa9 (diff) | |
| download | rust-e7b0b71197bb246c3213914919bdb959f39a8f74.tar.gz rust-e7b0b71197bb246c3213914919bdb959f39a8f74.zip | |
Remove moves from *T and implement in another way
Diffstat (limited to 'src/libstd/task/spawn.rs')
| -rw-r--r-- | src/libstd/task/spawn.rs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index 30ad4ee2a89..fa1790d79cb 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -98,10 +98,6 @@ use iterator::{IteratorUtil}; #[cfg(test)] use comm; #[cfg(test)] use task; -macro_rules! move_it ( - { $x:expr } => ( unsafe { let y = *ptr::to_unsafe_ptr(&($x)); y } ) -) - type TaskSet = HashSet<*rust_task>; fn new_taskset() -> TaskSet { @@ -638,23 +634,16 @@ fn spawn_raw_oldsched(mut opts: TaskOpts, f: ~fn()) { notify_chan: Option<Chan<TaskResult>>, f: ~fn()) -> ~fn() { - let child_data = Cell::new((child_arc, ancestors)); + let child_data = Cell::new((notify_chan, child_arc, ancestors)); let result: ~fn() = || { // Agh. Get move-mode items into the closure. FIXME (#2829) - let mut (child_arc, ancestors) = child_data.take(); + let mut (notify_chan, child_arc, ancestors) = child_data.take(); // Child task runs this code. // Even if the below code fails to kick the child off, we must // send Something on the notify channel. - //let mut notifier = None;//notify_chan.map(|c| AutoNotify(c)); - let notifier = match notify_chan { - Some(ref notify_chan_value) => { - let moved_ncv = move_it!(*notify_chan_value); - Some(AutoNotify(moved_ncv)) - } - _ => None - }; + let notifier = notify_chan.map_consume(|c| AutoNotify(c)); if enlist_many(child, &child_arc, &mut ancestors) { let group = @@mut TCB(child, |
