-
Notifications
You must be signed in to change notification settings - Fork 0
/
alarm.h
30 lines (24 loc) · 840 Bytes
/
alarm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef __ALARM_H__
#define __ALARM_H__ 1
#include "sortedlist.h"
/*
* This is the alarm interface. You should implement the functions for these
* prototypes, though you may have to modify some other files to do so.
*/
/* An alarm_handler_t is a function that will run within the interrupt handler.
* It must not block, and it must not perform I/O or any other long-running
* computations.
*/
typedef void (*alarm_handler_t)(void*);
typedef void *alarm_id;
extern int currentTime;
/* register an alarm to go off in "delay" milliseconds. Returns a handle to
* the alarm.
*/
alarm_id register_alarm(int delay, alarm_handler_t func, void *arg);
/* unregister an alarm. Returns 0 if the alarm had not been executed, 1
* otherwise.
*/
int deregister_alarm(alarm_id id);
void callAlarms(sortedlist_t list, int curtime);
#endif