Documentation from alarm.h

ROV

Introduction

[top]

ROVLib - Easy applications from C

Copyright - © Jason Tribbeck / 7th ARM 1994-2001

Contributing authors - Jason Tribbeck

File - alarm.h

Type - subsystem

Description

The alarm subsystem is used to maintain 'alarms' that are designed to go off at particular times, based on the OS_MonotonicTime clock.

For example, it can be used as a periodic poll, say to flash a cursor, or to maintain a socket, or as a once-off poll such as a message box that appears on the screen.

Each alarm that is set has three parameters - the time at which it is due to go off, the function to call, and a handle that the function can use to identify the alarm itself.

Once the time has been passed for the alarm to go off has been reached, the alarm handler function is called. Note that this is the minimum time that the function should be called, and can occur after the alarm was due.

alarm_proc (function pointer)

[top]

Definition of an alarm handler.

Parameters:

 - int time - the time that the alarm was due to go off.
 - int handle - the alarm handle value.

typedef void (*alarm_proc)(int time,
			   int handle);

See also: alarm_set()

alarm_init

[top]

Initialises the alarm subsystem. Do this before calling main_poll

void alarm_init(void);

alarm_set

[top]

Set an alarm.

Parameters:

 - int time - the time the alarm is due to go off.
 - alarm_proc proc - the alarm handler.
 - int handle - the alarm handle value.

void alarm_set(int time,
	       alarm_proc proc,
	       int handle);

See also: alarm_cancel(), alarm_proc()

alarm_cancel

[top]

Cancels an alarm.

Parameters:

 - int handle - the alarm handle value. This will cancel all alarms with this handle value.

void alarm_cancel(int handle);

See also: alarm_set()


Generated Thu Feb 7 23:22:51 2002