Skip to content

Commit 82303dd

Browse files
committed
---
yaml --- r: 71999 b: refs/heads/dist-snap c: 6b084ba h: refs/heads/master i: 71997: fc2762c 71995: 90daa3d 71991: 38eab25 71983: 344f68f 71967: 7a7b0f3 71935: 1bbe313 v: v3
1 parent 98e3b45 commit 82303dd

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
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: 1cb78e736f89cf286d454d7af05b470d570be1a7
10+
refs/heads/dist-snap: 6b084bad250e58c4003a1df40584f6385f44aac1
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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)