e01cebeb0a
- If the hook of the timer we're cancelling is currently being executed, we do now wait till it is finished. This is how the BeBook specifies the function to behave. - Periodic timers would not be cancelled, if their hook was being invoked at the same time, since they weren't in the queue during that time. - Since we know the CPU on which the timer is scheduled (timer::cpu), we don't have to look through any other CPU queue to find it. - Fixed the return value. It should report whether the timer had already fired, and was not always doing that. * Added private add_timer() flag B_TIMER_ACQUIRE_THREAD_LOCK. It causes the thread spinlock to be acquired before the event hook is called. cancel_timer() doesn't wait for timers with the flag set. Instead we check in the timer interrupt function after acquiring the thread spinlock whether the timer was cancelled in the meantime. Calling cancel_timer() with the thread spinlock being held does thus avoid any race conditions and won't deadlock, if the event hook needs to acquire the thread spinlock, too. This feature proves handy for some kernel internal needs. * The scheduler uses a B_TIMER_ACQUIRE_THREAD_LOCK timer now and cancel_timer() instead of the no longer needed _local_timer_cancel_event(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25098 a95241bf-73f2-0310-859d-f6bbb57e9c96
30 lines
537 B
C
30 lines
537 B
C
/*
|
|
** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
|
** Distributed under the terms of the OpenBeOS License.
|
|
*/
|
|
#ifndef _KERNEL_TIMER_H
|
|
#define _KERNEL_TIMER_H
|
|
|
|
|
|
#include <KernelExport.h>
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct kernel_args;
|
|
|
|
#define B_TIMER_ACQUIRE_THREAD_LOCK 0x8000
|
|
#define B_TIMER_FLAGS B_TIMER_ACQUIRE_THREAD_LOCK
|
|
|
|
/* kernel functions */
|
|
status_t timer_init(struct kernel_args *);
|
|
int32 timer_interrupt(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _KERNEL_TIMER_H */
|