core: Fix dec/inc_kernel_live_count mixup

This commit is contained in:
Zack Corr 2013-02-12 12:27:19 +10:00
parent ebd20b7944
commit 0db527e2f8

View File

@ -40,12 +40,12 @@ pub unsafe fn weaken_task(f: &fn(Port<ShutdownMsg>)) {
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(); }
}
}