Anope IRC Services  Version 1.8
timeout.h
Go to the documentation of this file.
1 /* Time-delay routine include stuff.
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  * Based on the original code of Epona by Lara.
9  * Based on the original code of Services by Andy Church.
10  *
11  *
12  */
13 
14 #ifndef TIMEOUT_H
15 #define TIMEOUT_H
16 
17 #include <time.h>
18 
19 
20 /* Definitions for timeouts: */
21 typedef struct timeout_ Timeout;
22 struct timeout_ {
24  time_t settime, timeout;
25  int repeat; /* Does this timeout repeat indefinitely? */
26  void (*code)(Timeout *); /* This structure is passed to the code */
27  void *data; /* Can be anything */
28 };
29 
30 
31 /* Check the timeout list for any pending actions. */
32 extern void check_timeouts(void);
33 
34 /* Add a timeout to the list to be triggered in `delay' seconds. Any
35  * timeout added from within a timeout routine will not be checked during
36  * that run through the timeout list.
37  */
38 extern Timeout *add_timeout(int delay, void (*code)(Timeout *), int repeat);
39 
40 /* Remove a timeout from the list (if it's there). */
41 extern void del_timeout(Timeout *t);
42 
43 #ifdef DEBUG_COMMANDS
44 /* Send the list of timeouts to the given user. */
45 extern int send_timeout_list(User *u);
46 #endif
47 
48 
49 #endif /* TIMEOUT_H */
Timeout * add_timeout(int delay, void(*code)(Timeout *), int repeat)
Definition: timeout.c:93
void(* code)(Timeout *)
Definition: timeout.h:26
Timeout * prev
Definition: timeout.h:23
void check_timeouts(void)
Definition: timeout.c:48
time_t settime
Definition: timeout.h:24
int repeat
Definition: timeout.h:25
void del_timeout(Timeout *t)
Definition: timeout.c:112
Timeout * next
Definition: timeout.h:23
time_t timeout
Definition: timeout.h:24
void * data
Definition: timeout.h:27