core: cleanup in task.rs for things missed in last rebase

This commit is contained in:
Jeff Olson
2012-08-27 23:03:04 -07:00
committed by Brian Anderson
parent d41af3e002
commit 2f32c0d5c3

View File

@@ -78,9 +78,9 @@ export ThreadPerTask;
export ManualThreads; export ManualThreads;
export PlatformThread; export PlatformThread;
macro_rules! move_it { macro_rules! move_it (
{ $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } } { $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } }
} )
/* Data types */ /* Data types */
@@ -209,7 +209,7 @@ type TaskOpts = {
linked: bool, linked: bool,
supervised: bool, supervised: bool,
mut notify_chan: Option<Chan<Notification>>, mut notify_chan: Option<Chan<Notification>>,
sched: option<SchedOpts>, sched: Option<SchedOpts>,
}; };
/** /**
@@ -254,7 +254,7 @@ priv impl TaskBuilder {
} }
self.consumed = true; self.consumed = true;
let notify_chan = if self.opts.notify_chan == None { let notify_chan = if self.opts.notify_chan == None {
none None
} else { } else {
Some(option::swap_unwrap(&mut self.opts.notify_chan)) Some(option::swap_unwrap(&mut self.opts.notify_chan))
}; };
@@ -450,12 +450,12 @@ impl TaskBuilder {
* must be greater than zero. * must be greater than zero.
*/ */
fn spawn(+f: fn~()) { fn spawn(+f: fn~()) {
let notify_chan = if self.opts.notify_chan == none { let notify_chan = if self.opts.notify_chan == None {
None None
} else { } else {
let swapped_notify_chan = let swapped_notify_chan =
option::swap_unwrap(&mut self.opts.notify_chan); option::swap_unwrap(&mut self.opts.notify_chan);
some(swapped_notify_chan) Some(swapped_notify_chan)
}; };
let x = self.consume(); let x = self.consume();
let opts = { let opts = {
@@ -1309,7 +1309,7 @@ fn spawn_raw(+opts: TaskOpts, +f: fn~()) {
//let mut notifier = None;//notify_chan.map(|c| AutoNotify(c)); //let mut notifier = None;//notify_chan.map(|c| AutoNotify(c));
let notifier = match notify_chan { let notifier = match notify_chan {
Some(notify_chan_value) => { Some(notify_chan_value) => {
let moved_ncv = move_it!{notify_chan_value}; let moved_ncv = move_it!(notify_chan_value);
Some(AutoNotify(moved_ncv)) Some(AutoNotify(moved_ncv))
} }
_ => None _ => None