haiku/headers/private/kernel/timer.h
Pawel Dziepak d8fcc8a825 kernel: Remove B_TIMER_ACQUIRE_SCHEDULER_LOCK flag
The flag main purpose is to avoid race conditions between event handler
and cancel_timer(). However, cancel_timer() is safe even without
using gSchedulerLock.

If the event is scheduled to happen on other CPU than the CPU that
invokes cancel_timer() then cancel_timer() either disables the event
before its handler starts executing or waits until the event handler
is done.

If the event is scheduled on the same CPU that calls cancel_timer()
then, since cancel_timer() disables interrupts, the event is either
executed before cancel_timer() or when the timer interrupt handler
starts running the event is already disabled.
2013-10-31 01:49:43 +01:00

52 lines
1.3 KiB
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_REAL_TIME_BASE 0x2000
// For an absolute timer the given time is interpreted as a real-time, not
// as a system time. Note that setting the real-time clock will cause the
// timer to be updated -- it will expire according to the new clock.
// Relative timers are unaffected by this flag.
#define B_TIMER_USE_TIMER_STRUCT_TIMES 0x4000
// For add_timer(): Use the timer::schedule_time (absolute time) and
// timer::period values instead of the period parameter.
#define B_TIMER_FLAGS \
(B_TIMER_USE_TIMER_STRUCT_TIMES | B_TIMER_REAL_TIME_BASE)
/* Timer info structure */
struct timer_info {
const char *name;
int (*get_priority)(void);
status_t (*set_hardware_timer)(bigtime_t timeout);
status_t (*clear_hardware_timer)(void);
status_t (*init)(struct kernel_args *args);
};
typedef struct timer_info timer_info;
/* kernel functions */
status_t timer_init(struct kernel_args *);
void timer_init_post_rtc(void);
void timer_real_time_clock_changed();
int32 timer_interrupt(void);
#ifdef __cplusplus
}
#endif
#endif /* _KERNEL_TIMER_H */