Skip to content

Commit 6b2cc38

Browse files
committed
---
yaml --- r: 140993 b: refs/heads/try2 c: 013b776 h: refs/heads/master i: 140991: 513686d v: v3
1 parent 83681f0 commit 6b2cc38

File tree

3 files changed

+34
-19
lines changed

3 files changed

+34
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: afcf4f2639ea58f847d0c7260a46d65738179fae
8+
refs/heads/try2: 013b7760b7bbc43ee56179588f8fe1a81d4567e5
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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

branches/try2/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)