* Cleaned up the code which also closes CID 176 which was not a bug, though.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38228 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
/*
|
||||
* Copyright 2002-2009, Haiku. All rights reserved.
|
||||
* Copyright 2002-2010, Haiku. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
|
||||
/*! Policy info for timers */
|
||||
|
||||
|
||||
#include <timer.h>
|
||||
|
||||
#include <OS.h>
|
||||
@@ -227,16 +229,15 @@ cancel_timer(timer *event)
|
||||
|
||||
per_cpu_timer_data& cpuData = sPerCPU[cpu];
|
||||
|
||||
timer *current = cpuData.events;
|
||||
|
||||
if (event != cpuData.current_event) {
|
||||
// The timer hook is not yet being executed.
|
||||
timer* current = cpuData.events;
|
||||
timer* last = NULL;
|
||||
|
||||
while (current != NULL) {
|
||||
if (current == event) {
|
||||
// we found it
|
||||
if (current == cpuData.events)
|
||||
if (last == NULL)
|
||||
cpuData.events = current->next;
|
||||
else
|
||||
last->next = current->next;
|
||||
@@ -267,11 +268,11 @@ cancel_timer(timer *event)
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
|
||||
// The timer hook is currently being executed. We clear the current
|
||||
// event so that timer_interrupt() will not reschedule periodic timers.
|
||||
cpuData.current_event = NULL;
|
||||
current = event;
|
||||
|
||||
// Unless this is a kernel-private timer that also requires the thread
|
||||
// lock to be held while calling the event hook, we'll have to wait
|
||||
@@ -288,7 +289,6 @@ cancel_timer(timer *event)
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user