From 0db527e2f8033e49ee588b3be71f3cd7a0d13b7c Mon Sep 17 00:00:00 2001 From: Zack Corr Date: Tue, 12 Feb 2013 12:27:19 +1000 Subject: [PATCH] core: Fix dec/inc_kernel_live_count mixup --- src/libcore/private/weak_task.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/private/weak_task.rs b/src/libcore/private/weak_task.rs index 1002fdb0c8c..7b9dfd9b457 100644 --- a/src/libcore/private/weak_task.rs +++ b/src/libcore/private/weak_task.rs @@ -40,12 +40,12 @@ pub unsafe fn weaken_task(f: &fn(Port)) { let task = get_task_id(); // Expect the weak task service to be alive assert service.try_send(RegisterWeakTask(task, shutdown_chan)); - unsafe { rust_inc_kernel_live_count(); } + unsafe { rust_dec_kernel_live_count(); } do fn&() { let shutdown_port = swap_unwrap(&mut *shutdown_port); f(shutdown_port) }.finally || { - unsafe { rust_dec_kernel_live_count(); } + unsafe { rust_inc_kernel_live_count(); } // Service my have already exited service.send(UnregisterWeakTask(task)); } @@ -78,11 +78,11 @@ fn create_global_service() -> ~WeakTaskService { let port = swap_unwrap(&mut *port); // The weak task service is itself a weak task debug!("weakening the weak service task"); - unsafe { rust_inc_kernel_live_count(); } + unsafe { rust_dec_kernel_live_count(); } run_weak_task_service(port); }.finally { debug!("unweakening the weak service task"); - unsafe { rust_dec_kernel_live_count(); } + unsafe { rust_inc_kernel_live_count(); } } }