|
|
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 <kern/lock.h>
36: #include <kern/queue.h>
37: #include <kern/zalloc.h>
38:
39: /*
40: * Timers in kernel:
41: */
42: extern unsigned long elapsed_ticks; /* number of ticks elapsed since bootup */
43: extern int hz; /* number of ticks per second */
44: extern int tick; /* number of usec per tick */
45:
46: /*
47: * Time-out element.
48: */
49: struct timer_elt {
50: queue_chain_t chain; /* chain in order of expiration */
51: int (*fcn)(); /* function to call */
52: char * param; /* with this parameter */
53: unsigned long ticks; /* expiration time, in ticks */
54: int set; /* unset | set | allocated */
55: };
56: #define TELT_UNSET 0 /* timer not set */
57: #define TELT_SET 1 /* timer set */
58: #define TELT_ALLOC 2 /* timer allocated from pool */
59:
60: typedef struct timer_elt timer_elt_data_t;
61: typedef struct timer_elt *timer_elt_t;
62:
63: /* for 'private' timer elements */
64: extern void set_timeout();
65: extern boolean_t reset_timeout();
66:
67: /* for public timer elements */
68: extern void timeout();
69: extern boolean_t untimeout();
70:
71: #define set_timeout_setup(telt,fcn,param,interval) \
72: ((telt)->fcn = (fcn), \
73: (telt)->param = (param), \
74: (telt)->private = TRUE, \
75: set_timeout((telt), (interval)))
76:
77: #define reset_timeout_check(t) \
78: MACRO_BEGIN \
79: if ((t)->set) \
80: reset_timeout((t)); \
81: MACRO_END
82:
83: #endif _KERN_TIME_OUT_H_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.