Skip to content

Commit bb3f606

Browse files
committed
---
yaml --- r: 36087 b: refs/heads/try2 c: f6d2a71 h: refs/heads/master i: 36085: 9acbcf5 36083: 9aeff31 36079: 4a8a496 v: v3
1 parent dd62d8a commit bb3f606

File tree

3 files changed

+12
-39
lines changed

3 files changed

+12
-39
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: b6bde885dc276b2fab3dd0b2de98627dcc304026
8+
refs/heads/try2: f6d2a7143629898aebea58db836eb2009e97d067
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/src/libcore/task.rs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,6 @@ impl TaskResult : Eq {
7373
pure fn ne(other: &TaskResult) -> bool { !self.eq(other) }
7474
}
7575

76-
/// A message type for notifying of task lifecycle events
77-
pub enum Notification {
78-
/// Sent when a task exits with the task handle and result
79-
Exit(Task, TaskResult)
80-
}
81-
82-
impl Notification : cmp::Eq {
83-
pure fn eq(other: &Notification) -> bool {
84-
match self {
85-
Exit(e0a, e1a) => {
86-
match (*other) {
87-
Exit(e0b, e1b) => e0a == e0b && e1a == e1b
88-
}
89-
}
90-
}
91-
}
92-
pure fn ne(other: &Notification) -> bool { !self.eq(other) }
93-
}
94-
9576
/// Scheduler modes
9677
pub enum SchedMode {
9778
/// All tasks run in the same OS thread
@@ -201,7 +182,7 @@ pub type SchedOpts = {
201182
pub type TaskOpts = {
202183
linked: bool,
203184
supervised: bool,
204-
mut notify_chan: Option<Chan<Notification>>,
185+
mut notify_chan: Option<Chan<TaskResult>>,
205186
sched: Option<SchedOpts>,
206187
};
207188

@@ -344,12 +325,10 @@ impl TaskBuilder {
344325
}
345326
346327
// Construct the future and give it to the caller.
347-
let (notify_pipe_ch, notify_pipe_po) = stream::<Notification>();
328+
let (notify_pipe_ch, notify_pipe_po) = stream::<TaskResult>();
348329
349330
blk(do future::from_fn |move notify_pipe_po| {
350-
match notify_pipe_po.recv() {
351-
Exit(_, result) => result
352-
}
331+
notify_pipe_po.recv()
353332
});
354333
355334
// Reconfigure self to use a notify channel.

branches/try2/src/libcore/task/spawn.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -320,15 +320,15 @@ fn TCB(me: *rust_task, tasks: TaskGroupArc, ancestors: AncestorList,
320320
}
321321

322322
struct AutoNotify {
323-
notify_chan: Chan<Notification>,
323+
notify_chan: Chan<TaskResult>,
324324
mut failed: bool,
325325
drop {
326326
let result = if self.failed { Failure } else { Success };
327-
self.notify_chan.send(Exit(get_task(), result));
327+
self.notify_chan.send(result);
328328
}
329329
}
330330

331-
fn AutoNotify(chan: Chan<Notification>) -> AutoNotify {
331+
fn AutoNotify(chan: Chan<TaskResult>) -> AutoNotify {
332332
AutoNotify {
333333
notify_chan: move chan,
334334
failed: true // Un-set above when taskgroup successfully made.
@@ -532,7 +532,7 @@ pub fn spawn_raw(opts: TaskOpts, f: fn~()) {
532532
// (4) ...and runs the provided body function.
533533
fn make_child_wrapper(child: *rust_task, child_arc: TaskGroupArc,
534534
ancestors: AncestorList, is_main: bool,
535-
notify_chan: Option<Chan<Notification>>,
535+
notify_chan: Option<Chan<TaskResult>>,
536536
f: fn~()) -> fn~() {
537537
let child_data = ~mut Some((move child_arc, move ancestors));
538538
return fn~(move notify_chan, move child_data, move f) {
@@ -660,36 +660,30 @@ fn test_spawn_raw_unsupervise() {
660660
#[test]
661661
#[ignore(cfg(windows))]
662662
fn test_spawn_raw_notify_success() {
663-
let (task_ch, task_po) = pipes::stream();
664663
let (notify_ch, notify_po) = pipes::stream();
665664

666665
let opts = {
667666
notify_chan: Some(move notify_ch),
668667
.. default_task_opts()
669668
};
670-
do spawn_raw(move opts) |move task_ch| {
671-
task_ch.send(get_task());
669+
do spawn_raw(move opts) {
672670
}
673-
let task_ = task_po.recv();
674-
assert notify_po.recv() == Exit(task_, Success);
671+
assert notify_po.recv() == Success;
675672
}
676673

677674
#[test]
678675
#[ignore(cfg(windows))]
679676
fn test_spawn_raw_notify_failure() {
680677
// New bindings for these
681-
let (task_ch, task_po) = pipes::stream();
682678
let (notify_ch, notify_po) = pipes::stream();
683679

684680
let opts = {
685681
linked: false,
686682
notify_chan: Some(move notify_ch),
687683
.. default_task_opts()
688684
};
689-
do spawn_raw(move opts) |move task_ch| {
690-
task_ch.send(get_task());
685+
do spawn_raw(move opts) {
691686
fail;
692687
}
693-
let task_ = task_po.recv();
694-
assert notify_po.recv() == Exit(task_, Failure);
688+
assert notify_po.recv() == Failure;
695689
}

0 commit comments

Comments
 (0)