Skip to content

Commit 62ec0fa

Browse files
committed
---
yaml --- r: 65887 b: refs/heads/master c: 90fbe38 h: refs/heads/master i: 65885: 1263ca2 65883: 836ac76 65879: 30f79cb 65871: cc9caba 65855: 5928e78 v: v3
1 parent 7179f63 commit 62ec0fa

File tree

6 files changed

+14
-58
lines changed

6 files changed

+14
-58
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: fd148cd3e2d08ce15272f0690f6e41d2e85ee721
2+
refs/heads/master: 90fbe38f0064836fd5e169c520d3fd19953e5604
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/src/libstd/rt/task.rs

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub struct Task {
2525
gc: GarbageCollector,
2626
storage: LocalStorage,
2727
logger: StdErrLogger,
28-
unwinder: Option<Unwinder>,
28+
unwinder: Unwinder,
2929
destroyed: bool
3030
}
3131

@@ -43,18 +43,7 @@ impl Task {
4343
gc: GarbageCollector,
4444
storage: LocalStorage(ptr::null(), None),
4545
logger: StdErrLogger,
46-
unwinder: Some(Unwinder { unwinding: false }),
47-
destroyed: false
48-
}
49-
}
50-
51-
pub fn new_root_without_unwinding() -> Task {
52-
Task {
53-
heap: LocalHeap::new(),
54-
gc: GarbageCollector,
55-
storage: LocalStorage(ptr::null(), None),
56-
logger: StdErrLogger,
57-
unwinder: None,
46+
unwinder: Unwinder { unwinding: false },
5847
destroyed: false
5948
}
6049
}
@@ -65,18 +54,7 @@ impl Task {
6554
gc: GarbageCollector,
6655
storage: LocalStorage(ptr::null(), None),
6756
logger: StdErrLogger,
68-
unwinder: Some(Unwinder { unwinding: false }),
69-
destroyed: false
70-
}
71-
}
72-
73-
pub fn new_child_without_unwinding(&mut self) -> Task {
74-
Task {
75-
heap: LocalHeap::new(),
76-
gc: GarbageCollector,
77-
storage: LocalStorage(ptr::null(), None),
78-
logger: StdErrLogger,
79-
unwinder: None,
57+
unwinder: Unwinder { unwinding: false },
8058
destroyed: false
8159
}
8260
}
@@ -88,16 +66,7 @@ impl Task {
8866
assert!(ptr::ref_eq(task, self));
8967
}
9068

91-
match self.unwinder {
92-
Some(ref mut unwinder) => {
93-
// If there's an unwinder then set up the catch block
94-
unwinder.try(f);
95-
}
96-
None => {
97-
// Otherwise, just run the body
98-
f()
99-
}
100-
}
69+
self.unwinder.try(f);
10170
self.destroy();
10271
}
10372

trunk/src/libstd/rt/test.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub fn run_in_newsched_task(f: ~fn()) {
4848
do run_in_bare_thread {
4949
let mut sched = ~new_test_uv_sched();
5050
let task = ~Coroutine::with_task(&mut sched.stack_pool,
51-
~Task::new_root_without_unwinding(),
51+
~Task::new_root(),
5252
f.take());
5353
sched.enqueue_task(task);
5454
sched.run();
@@ -134,7 +134,7 @@ pub fn spawntask(f: ~fn()) {
134134

135135
let mut task = None;
136136
do Local::borrow::<Task>() |running_task| {
137-
task = Some(~running_task.new_child_without_unwinding());
137+
task = Some(~running_task.new_child());
138138
}
139139

140140
let mut sched = Local::take::<Scheduler>();
@@ -150,7 +150,7 @@ pub fn spawntask_immediately(f: ~fn()) {
150150

151151
let mut task = None;
152152
do Local::borrow::<Task>() |running_task| {
153-
task = Some(~running_task.new_child_without_unwinding());
153+
task = Some(~running_task.new_child());
154154
}
155155

156156
let mut sched = Local::take::<Scheduler>();
@@ -168,7 +168,7 @@ pub fn spawntask_later(f: ~fn()) {
168168

169169
let mut task = None;
170170
do Local::borrow::<Task>() |running_task| {
171-
task = Some(~running_task.new_child_without_unwinding());
171+
task = Some(~running_task.new_child());
172172
}
173173

174174
let mut sched = Local::take::<Scheduler>();
@@ -187,7 +187,7 @@ pub fn spawntask_random(f: ~fn()) {
187187

188188
let mut task = None;
189189
do Local::borrow::<Task>() |running_task| {
190-
task = Some(~running_task.new_child_without_unwinding());
190+
task = Some(~running_task.new_child());
191191
}
192192

193193
let mut sched = Local::take::<Scheduler>();
@@ -251,7 +251,7 @@ pub fn spawntask_thread(f: ~fn()) -> Thread {
251251

252252
let mut task = None;
253253
do Local::borrow::<Task>() |running_task| {
254-
task = Some(~running_task.new_child_without_unwinding());
254+
task = Some(~running_task.new_child());
255255
}
256256

257257
let task = Cell(task.swap_unwrap());

trunk/src/libstd/sys.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,7 @@ pub fn begin_unwind_(msg: *c_char, file: *c_char, line: size_t) -> ! {
226226
gc::cleanup_stack_for_failure();
227227

228228
let task = Local::unsafe_borrow::<Task>();
229-
let unwinder: &mut Option<Unwinder> = &mut (*task).unwinder;
230-
match *unwinder {
231-
Some(ref mut unwinder) => unwinder.begin_unwind(),
232-
None => abort!("failure without unwinder. aborting process")
233-
}
229+
(*task).unwinder.begin_unwind();
234230
}
235231
}
236232
}

trunk/src/libstd/task/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -515,16 +515,7 @@ pub fn failing() -> bool {
515515
_ => {
516516
let mut unwinding = false;
517517
do Local::borrow::<Task> |local| {
518-
unwinding = match local.unwinder {
519-
Some(unwinder) => {
520-
unwinder.unwinding
521-
}
522-
None => {
523-
// Because there is no unwinder we can't be unwinding.
524-
// (The process will abort on failure)
525-
false
526-
}
527-
}
518+
unwinding = local.unwinder.unwinding
528519
}
529520
return unwinding;
530521
}

trunk/src/libstd/task/spawn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ fn spawn_raw_newsched(_opts: TaskOpts, f: ~fn()) {
579579

580580
let mut task = None;
581581
do Local::borrow::<Task>() |running_task| {
582-
task = Some(~running_task.new_child_without_unwinding());
582+
task = Some(~running_task.new_child());
583583
}
584584

585585
let mut sched = Local::take::<Scheduler>();

0 commit comments

Comments
 (0)