Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / rx / rx_event.h
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10 /* Event package */
11
12 #ifndef OPENAFS_RX_EVENT_H
13 #define OPENAFS_RX_EVENT_H
14
15 /* This routine must be called to initialize the event package.
16 * nEvents is the number of events to allocate in a batch whenever
17 * more are needed. If this is 0, a default number (10) will be
18 * allocated. */
19 extern void rxevent_Init( int nEvents, void (*scheduler)(void) );
20
21 /* Arrange for the indicated event at the appointed time. when is a
22 * "struct clock", in the clock.c time base */
23 struct clock;
24 struct rxevent;
25 extern struct rxevent *rxevent_Post(struct clock *when, struct clock *now,
26 void (*func) (struct rxevent *, void *,
27 void *, int),
28 void *arg, void *arg1, int arg2);
29
30 /* Remove the indicated event from the event queue. The event must be
31 * pending. Note that a currently executing event may not cancel itself.
32 */
33 extern int rxevent_Cancel(struct rxevent **);
34
35 /* The actions specified for each event that has reached the current clock
36 * time will be taken. The current time returned by GetTime is used
37 * (warning: this may be an old time if the user has not called
38 * clock_NewTime)
39 */
40 extern int rxevent_RaiseEvents(struct clock *wait);
41
42 /* Acquire a reference to an event */
43 extern struct rxevent *rxevent_Get(struct rxevent *event);
44
45 /* Release a reference to an event */
46 extern void rxevent_Put(struct rxevent **event);
47
48 /* Shutdown the event package */
49 extern void shutdown_rxevent(void);
50
51 #endif /* _EVENT_ */