ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/vendor/ircservices-5.1.24/timeout.h
Revision: 3389
Committed: Fri Apr 25 14:12:15 2014 UTC (11 years, 4 months ago) by michael
Content type: text/x-chdr
File size: 2198 byte(s)
Log Message:
- Imported ircservices-5.1.24

File Contents

# Content
1 /* Time-delay routine include stuff.
2 *
3 * IRC Services is copyright (c) 1996-2009 Andrew Church.
4 * E-mail: <achurch@achurch.org>
5 * Parts written by Andrew Kempe and others.
6 * This program is free but copyrighted software; see the file GPL.txt for
7 * details.
8 */
9
10 #ifndef TIMEOUT_H
11 #define TIMEOUT_H
12
13 #include <time.h>
14
15 /*************************************************************************/
16
17 /* Timeout type. */
18
19 typedef struct timeout_ Timeout;
20
21 struct timeout_ {
22 void *data; /* Caller data; can be anything */
23 time_t settime; /* Time timer was set (from time()) */
24 /* Remainder is PRIVATE DATA! */
25 #ifdef IN_TIMEOUT_C
26 Timeout *next, *prev;
27 uint32 timeout; /* In milliseconds (time_msec()) */
28 uint32 repeat; /* Does this timeout repeat indefinitely?
29 * (if nonzero, new value of `timeout') */
30 void (*code)(Timeout *); /* This structure is passed to the code */
31 #endif
32 };
33
34 /*************************************************************************/
35
36 /* Check the timeout list for any pending actions. */
37 extern void check_timeouts(void);
38
39 /* Add a timeout to the list to be triggered in `delay' seconds (`delay'
40 * may be zero). Any timeout added from within a timeout routine will not
41 * be checked during that run through the timeout list. Always succeeds. */
42 extern Timeout *add_timeout(int delay, void (*code)(Timeout *), int repeat);
43
44 /* Add a timeout to the list to be triggered in `delay' milliseconds
45 * (`delay' may be zero). */
46 extern Timeout *add_timeout_ms(uint32 delay, void (*code)(Timeout *),
47 int repeat);
48
49 /* Remove a timeout from the list (if it's there). */
50 extern void del_timeout(Timeout *t);
51
52 #ifdef DEBUG_COMMANDS
53 /* Send the list of timeouts to the given user. */
54 extern void send_timeout_list(User *u);
55 #endif
56
57 /*************************************************************************/
58
59 #endif /* TIMEOUT_H */
60
61 /*
62 * Local variables:
63 * c-file-style: "stroustrup"
64 * c-file-offsets: ((case-label . *) (statement-case-intro . *))
65 * indent-tabs-mode: nil
66 * End:
67 *
68 * vim: expandtab shiftwidth=4:
69 */