* 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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||||
* Distributed under the terms of the NewOS License.
|
* Distributed under the terms of the NewOS License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*! Policy info for timers */
|
/*! Policy info for timers */
|
||||||
|
|
||||||
|
|
||||||
#include <timer.h>
|
#include <timer.h>
|
||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
@@ -227,16 +229,15 @@ cancel_timer(timer *event)
|
|||||||
|
|
||||||
per_cpu_timer_data& cpuData = sPerCPU[cpu];
|
per_cpu_timer_data& cpuData = sPerCPU[cpu];
|
||||||
|
|
||||||
timer *current = cpuData.events;
|
|
||||||
|
|
||||||
if (event != cpuData.current_event) {
|
if (event != cpuData.current_event) {
|
||||||
// The timer hook is not yet being executed.
|
// The timer hook is not yet being executed.
|
||||||
|
timer* current = cpuData.events;
|
||||||
timer* last = NULL;
|
timer* last = NULL;
|
||||||
|
|
||||||
while (current != NULL) {
|
while (current != NULL) {
|
||||||
if (current == event) {
|
if (current == event) {
|
||||||
// we found it
|
// we found it
|
||||||
if (current == cpuData.events)
|
if (last == NULL)
|
||||||
cpuData.events = current->next;
|
cpuData.events = current->next;
|
||||||
else
|
else
|
||||||
last->next = current->next;
|
last->next = current->next;
|
||||||
@@ -267,11 +268,11 @@ cancel_timer(timer *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
// The timer hook is currently being executed. We clear the current
|
// The timer hook is currently being executed. We clear the current
|
||||||
// event so that timer_interrupt() will not reschedule periodic timers.
|
// event so that timer_interrupt() will not reschedule periodic timers.
|
||||||
cpuData.current_event = NULL;
|
cpuData.current_event = NULL;
|
||||||
current = event;
|
|
||||||
|
|
||||||
// Unless this is a kernel-private timer that also requires the thread
|
// 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
|
// lock to be held while calling the event hook, we'll have to wait
|
||||||
@@ -288,7 +289,6 @@ cancel_timer(timer *event)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user