File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed
branches/try2/src/libstd/task Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5
5
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
- refs/heads/try2: 7826651335b81f4630aa4d0d43a5de95b96d2311
8
+ refs/heads/try2: 29c9443d854073feeceb7ec2afa5841d9d1242af
9
9
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -497,11 +497,26 @@ pub fn try<T:Send>(f: ~fn() -> T) -> Result<T,()> {
497
497
pub fn yield ( ) {
498
498
//! Yield control to the task scheduler
499
499
500
+ use rt:: { context, OldTaskContext } ;
501
+ use rt:: local:: Local ;
502
+ use rt:: sched:: Scheduler ;
503
+
500
504
unsafe {
501
- let task_ = rt:: rust_get_task ( ) ;
502
- let killed = rt:: rust_task_yield ( task_) ;
503
- if killed && !failing ( ) {
504
- fail ! ( "killed" ) ;
505
+ match context ( ) {
506
+ OldTaskContext => {
507
+ let task_ = rt:: rust_get_task ( ) ;
508
+ let killed = rt:: rust_task_yield ( task_) ;
509
+ if killed && !failing ( ) {
510
+ fail ! ( "killed" ) ;
511
+ }
512
+ }
513
+ _ => {
514
+ // XXX: What does yield really mean in newsched?
515
+ let sched = Local :: take :: < Scheduler > ( ) ;
516
+ do sched. deschedule_running_task_and_then |sched, task| {
517
+ sched. enqueue_task ( task) ;
518
+ }
519
+ }
505
520
}
506
521
}
507
522
}
You can’t perform that action at this time.
0 commit comments