FreeBSD/Linux Kernel Cross Reference
sys/kern/eventcount.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1993-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 Software.Distribution@CS.CMU.EDU
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 * HISTORY
28 * $Log: eventcount.h,v $
29 * Revision 2.7 93/11/17 17:09:07 dbg
30 * Changed evc_notify_abort to evc_wait_interrupt, since it is only
31 * used by thread_halt (to 'interrupt' an evc_wait). It knows
32 * about the evc_wait continuation.
33 * [93/08/20 dbg]
34 *
35 * Added return value to evc_init.
36 * [93/03/02 dbg]
37 *
38 * Added include files for data types used.
39 * [93/01/28 dbg]
40 *
41 * Revision 2.6 93/08/10 15:12:05 mrt
42 * Changed ev_id to natural_t to match the changes in
43 * eventcount.c
44 * [93/08/03 mrt]
45 *
46 * Revision 2.5 93/01/24 13:18:53 danner
47 * Prototypes, evc_notify_abort.
48 * [93/01/22 danner]
49 *
50 * Revision 2.4 93/01/14 17:34:03 danner
51 * Allow count to go negative.
52 * [92/12/15 af]
53 *
54 * Revision 2.3 92/01/03 20:40:10 dbg
55 * Added id field to make user-safe. Since we have not
56 * decided what the user-interface will look like (and
57 * we are using it nonetheless) do not define anything.
58 * [91/12/27 af]
59 *
60 * Revision 2.2 91/12/13 14:54:47 jsb
61 * Created.
62 * [91/11/01 af]
63 *
64 */
65 /*
66 * File: eventcount.c
67 * Author: Alessandro Forin
68 * Date: 10/91
69 *
70 * Eventcounters, for user-level drivers synchronization
71 *
72 */
73
74 #ifndef _KERN_EVENTCOUNT_H_
75 #define _KERN_EVENTCOUNT_H_ 1
76
77 #include <mach/boolean.h>
78 #include <mach/kern_return.h>
79 #include <mach/machine/vm_types.h> /* for natural_t */
80 #include <kern/kern_types.h>
81 #include <kern/lock.h>
82
83 /* kernel visible only */
84
85 typedef struct evc {
86 int count;
87 thread_t waiting_thread;
88 natural_t ev_id;
89 struct evc *sanity;
90 decl_simple_lock_data(, lock)
91 } *evc_t;
92
93 extern kern_return_t evc_init(evc_t ev);
94
95 extern void evc_destroy(evc_t ev);
96 extern void evc_signal(evc_t ev);
97 extern boolean_t evc_wait_interrupt(thread_t thread);
98
99 /* kernel and user visible */
100
101 extern kern_return_t evc_wait(natural_t ev_id);
102 extern kern_return_t evc_wait_clear(natural_t ev_id);
103
104 #endif /* _KERN_EVENTCOUNT_H_ */
Cache object: 1ef4183abea3f21639aa3be26fdc84da
|