1/*
2 * LICENSE NOTICE.
3 *
4 * Use of the Microsoft Windows Rally Development Kit is covered under
5 * the Microsoft Windows Rally Development Kit License Agreement,
6 * which is provided within the Microsoft Windows Rally Development
7 * Kit or at http://www.microsoft.com/whdc/rally/rallykit.mspx. If you
8 * want a license from Microsoft to use the software in the Microsoft
9 * Windows Rally Development Kit, you must (1) complete the designated
10 * "licensee" information in the Windows Rally Development Kit License
11 * Agreement, and (2) sign and return the Agreement AS IS to Microsoft
12 * at the address provided in the Agreement.
13 */
14
15/*
16 * Copyright (c) Microsoft Corporation 2005.  All rights reserved.
17 * This software is provided with NO WARRANTY.
18 */
19
20#ifndef EVENT_H
21#define EVENT_H
22
23/* socket and timeout event dispatcher */
24#include <sys/time.h>
25
26/* Initialise the eventing system */
27extern void event_init(void);
28
29/* Add a new event to the list, calling "function(state)" at "firetime". */
30extern event_t *event_add(struct timeval *firetime, event_fn_t function, void *state);
31
32/* Cancel a previously requested event; return TRUE if successful, FALSE if the
33 * event wasn't found. */
34extern bool_t event_cancel(event_t *event);
35
36/* You can register a handler function to deal with IO on a file descriptor: */
37/* NB: Limited to one fd of interest only! */
38typedef void (*event_io_fn_t)(int fd, void *state);
39extern void event_add_io(int fd, event_io_fn_t function, void *state);
40extern void event_remove_io(int fd);
41
42/* Capture the current thread, and run event and IO handlers forever.
43 * Does not return. */
44extern void event_mainloop(void);
45
46#endif /* EVENT_H */
47