Skip to content

Commit 013b776

Browse files
committed
core: Turn task::unkillable, etc. into no-ops in newsched. #6377
Not necessary just yet but they make ARC not work.
1 parent afcf4f2 commit 013b776

File tree

2 files changed

+33
-18
lines changed

2 files changed

+33
-18
lines changed

src/libcore/rt/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ mod local_heap;
113113
pub mod logging;
114114

115115
/// Tools for testing the runtime
116-
#[cfg(test)]
117116
pub mod test;
118117

119118
/// Reference counting

src/libcore/task/mod.rs

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ use task::rt::{task_id, sched_id};
4343
use util;
4444
use util::replace;
4545
use unstable::finally::Finally;
46+
use rt::{context, OldTaskContext};
4647

4748
#[cfg(test)] use comm::SharedChan;
4849

@@ -558,23 +559,33 @@ pub fn get_scheduler() -> Scheduler {
558559
* ~~~
559560
*/
560561
pub unsafe fn unkillable<U>(f: &fn() -> U) -> U {
561-
let t = rt::rust_get_task();
562-
do (|| {
563-
rt::rust_task_inhibit_kill(t);
562+
if context() == OldTaskContext {
563+
let t = rt::rust_get_task();
564+
do (|| {
565+
rt::rust_task_inhibit_kill(t);
566+
f()
567+
}).finally {
568+
rt::rust_task_allow_kill(t);
569+
}
570+
} else {
571+
// FIXME #6377
564572
f()
565-
}).finally {
566-
rt::rust_task_allow_kill(t);
567573
}
568574
}
569575

570576
/// The inverse of unkillable. Only ever to be used nested in unkillable().
571577
pub unsafe fn rekillable<U>(f: &fn() -> U) -> U {
572-
let t = rt::rust_get_task();
573-
do (|| {
574-
rt::rust_task_allow_kill(t);
578+
if context() == OldTaskContext {
579+
let t = rt::rust_get_task();
580+
do (|| {
581+
rt::rust_task_allow_kill(t);
582+
f()
583+
}).finally {
584+
rt::rust_task_inhibit_kill(t);
585+
}
586+
} else {
587+
// FIXME #6377
575588
f()
576-
}).finally {
577-
rt::rust_task_inhibit_kill(t);
578589
}
579590
}
580591

@@ -583,14 +594,19 @@ pub unsafe fn rekillable<U>(f: &fn() -> U) -> U {
583594
* For use with exclusive ARCs, which use pthread mutexes directly.
584595
*/
585596
pub unsafe fn atomically<U>(f: &fn() -> U) -> U {
586-
let t = rt::rust_get_task();
587-
do (|| {
588-
rt::rust_task_inhibit_kill(t);
589-
rt::rust_task_inhibit_yield(t);
597+
if context() == OldTaskContext {
598+
let t = rt::rust_get_task();
599+
do (|| {
600+
rt::rust_task_inhibit_kill(t);
601+
rt::rust_task_inhibit_yield(t);
602+
f()
603+
}).finally {
604+
rt::rust_task_allow_yield(t);
605+
rt::rust_task_allow_kill(t);
606+
}
607+
} else {
608+
// FIXME #6377
590609
f()
591-
}).finally {
592-
rt::rust_task_allow_yield(t);
593-
rt::rust_task_allow_kill(t);
594610
}
595611
}
596612

0 commit comments

Comments
 (0)