Skip to content

Commit c35b700

Browse files
committed
---
yaml --- r: 55527 b: refs/heads/master c: a2e5827 h: refs/heads/master i: 55525: ce13d98 55523: 919c5e8 55519: 14651ff v: v3
1 parent 857e7a6 commit c35b700

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
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: 5f52aecb1e7a53bf46280d057654746c34e89859
2+
refs/heads/master: a2e5827866876e9bafcf1f4e94f4e354e500420a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
55
refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a

trunk/src/libcore/rt/sched.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ impl HackAroundBorrowCk for UnsafeTaskReceiver {
6060
}
6161

6262
enum CleanupJob {
63+
DoNothing,
6364
RescheduleTask(~Task),
6465
RecycleTask(~Task),
6566
GiveTask(~Task, UnsafeTaskReceiver)
@@ -148,6 +149,7 @@ pub impl Scheduler {
148149

149150
// Store the task in the scheduler so it can be grabbed later
150151
self.current_task = Some(task);
152+
self.enqueue_cleanup_job(DoNothing);
151153

152154
// Take pointers to both the task and scheduler's saved registers.
153155
{
@@ -243,14 +245,13 @@ pub impl Scheduler {
243245
}
244246

245247
fn run_cleanup_job(&mut self) {
246-
rtdebug!("running cleanup jobs");
248+
rtdebug!("running cleanup job");
247249

248-
if self.cleanup_job.is_none() {
249-
return;
250-
}
250+
assert!(self.cleanup_job.is_some());
251251

252252
let cleanup_job = self.cleanup_job.swap_unwrap();
253253
match cleanup_job {
254+
DoNothing => { }
254255
RescheduleTask(task) => {
255256
// NB: Pushing to the *front* of the queue
256257
self.task_queue.push_front(task);
@@ -278,9 +279,10 @@ pub impl Scheduler {
278279
Some(GiveTask(~ref task, _)) => {
279280
Some(task)
280281
}
281-
None => {
282+
Some(DoNothing) => {
282283
None
283284
}
285+
None => fail!(fmt!("all context switches should have a cleanup job"))
284286
};
285287
// XXX: Pattern matching mutable pointers above doesn't work
286288
// because borrowck thinks the three patterns are conflicting

0 commit comments

Comments
 (0)