From c4093b4a83dc1660257c88ca7834c46530010985 Mon Sep 17 00:00:00 2001 From: Flaper Fesp Date: Sun, 18 Aug 2013 18:07:20 +0200 Subject: Testing rekillable fails when called from outside an unkillable block --- src/libstd/task/mod.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/libstd/task') diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index bac4991d858..c66296723b1 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -598,7 +598,8 @@ pub fn unkillable(f: &fn() -> U) -> U { } /** - * Makes killable a task marked as unkillable + * Makes killable a task marked as unkillable. This + * is meant to be used only nested in unkillable. * * # Example * @@ -607,6 +608,7 @@ pub fn unkillable(f: &fn() -> U) -> U { * do task::rekillable { * // Task is killable * } + * // Task is unkillable again * } */ pub fn rekillable(f: &fn() -> U) -> U { @@ -1237,6 +1239,20 @@ fn test_unkillable_nested() { po.recv(); } +#[ignore(reason = "linked failure")] +#[test] +#[ignore(cfg(windows))] +#[should_fail] +fn test_rekillable_not_nested() { + do rekillable { + // This should fail before + // receiving anything since + // this block should be nested + // into a unkillable block. + yield(); + } +} + #[test] fn test_child_doesnt_ref_parent() { // If the child refcounts the parent task, this will stack overflow when -- cgit 1.4.1-3-g733a5