mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
core: Fix dec/inc_kernel_live_count mixup
This commit is contained in:
parent
ebd20b7944
commit
0db527e2f8
@ -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(); }
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user