|
|
1.1 root 1: /*
2: * Mach Operating System
3: * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
4: * All Rights Reserved.
5: *
6: * Permission to use, copy, modify and distribute this software and its
7: * documentation is hereby granted, provided that both the copyright
8: * notice and this permission notice appear in all copies of the
9: * software, derivative works or modified versions, and any portions
10: * thereof, and that both notices appear in supporting documentation.
11: *
12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15: *
16: * Carnegie Mellon requests users of this software to return to
17: *
18: * Software Distribution Coordinator or [email protected]
19: * School of Computer Science
20: * Carnegie Mellon University
21: * Pittsburgh PA 15213-3890
22: *
23: * any improvements or extensions that they make and grant Carnegie Mellon
24: * the rights to redistribute these changes.
25: */
26:
27: #ifndef _KERN_TIME_OUT_H_
28: #define _KERN_TIME_OUT_H_
29:
30: /*
31: * Mach time-out and time-of-day facility.
32: */
33:
34: #include <mach/boolean.h>
35: #include <mach/time_value.h>
36: #include <kern/lock.h>
37: #include <kern/queue.h>
38: #include <kern/zalloc.h>
39:
40: /*
41: * Timers in kernel:
42: */
43: extern unsigned long elapsed_ticks; /* number of ticks elapsed since bootup */
44: extern int hz; /* number of ticks per second */
45: extern int tick; /* number of usec per tick */
46:
47: /* Read the current time into STAMP */
48: void record_time_stamp (time_value_t *stamp);
49:
50: /*
51: * Time-out element.
52: */
53: struct timer_elt {
54: queue_chain_t chain; /* chain in order of expiration */
55: int (*fcn)(); /* function to call */
56: char * param; /* with this parameter */
57: unsigned long ticks; /* expiration time, in ticks */
58: int set; /* unset | set | allocated */
59: };
60: #define TELT_UNSET 0 /* timer not set */
61: #define TELT_SET 1 /* timer set */
62: #define TELT_ALLOC 2 /* timer allocated from pool */
63:
64: typedef struct timer_elt timer_elt_data_t;
65: typedef struct timer_elt *timer_elt_t;
66:
67: /* for 'private' timer elements */
68: extern void set_timeout();
69: extern boolean_t reset_timeout();
70:
71: /* for public timer elements */
72: extern void timeout();
73: extern boolean_t untimeout();
74:
75: #define set_timeout_setup(telt,fcn,param,interval) \
76: ((telt)->fcn = (fcn), \
77: (telt)->param = (param), \
78: (telt)->private = TRUE, \
79: set_timeout((telt), (interval)))
80:
81: #define reset_timeout_check(t) \
82: MACRO_BEGIN \
83: if ((t)->set) \
84: reset_timeout((t)); \
85: MACRO_END
86:
87: #endif /* _KERN_TIME_OUT_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.