Skip to content

Commit ce13d98

Browse files
committed
---
yaml --- r: 55525 b: refs/heads/master c: 6b084ba h: refs/heads/master i: 55523: 919c5e8 v: v3
1 parent 704c919 commit ce13d98

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-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: 1cb78e736f89cf286d454d7af05b470d570be1a7
2+
refs/heads/master: 6b084bad250e58c4003a1df40584f6385f44aac1
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: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ pub impl Scheduler {
212212
Context::swap(last_task_context, sched_context);
213213
}
214214

215-
// XXX: Should probably run cleanup jobs
215+
self.run_cleanup_jobs();
216216
}
217217

218218
/// Switch directly to another task, without going through the scheduler.
@@ -233,7 +233,7 @@ pub impl Scheduler {
233233
Context::swap(last_task_context, next_task_context);
234234
}
235235

236-
// XXX: Should probably run cleanup jobs
236+
self.run_cleanup_jobs();
237237
}
238238

239239
// * Other stuff
@@ -245,7 +245,6 @@ pub impl Scheduler {
245245
}
246246

247247
fn run_cleanup_jobs(&mut self) {
248-
assert!(!self.in_task_context());
249248
rtdebug!("running cleanup jobs");
250249

251250
while !self.cleanup_jobs.is_empty() {
@@ -325,8 +324,12 @@ pub impl Task {
325324
priv fn build_start_wrapper(start: ~fn()) -> ~fn() {
326325
// XXX: The old code didn't have this extra allocation
327326
let wrapper: ~fn() = || {
328-
// XXX: Should probably run scheduler cleanup jobs for situations
329-
// where a task context switches directly to a new task
327+
// This is the first code to execute after the initial
328+
// context switch to the task. The previous context may
329+
// have asked us to do some cleanup.
330+
let mut sched = ThreadLocalScheduler::new();
331+
let sched = sched.get_scheduler();
332+
sched.run_cleanup_jobs();
330333

331334
start();
332335

0 commit comments

Comments
 (0)