xref: /haiku/src/libs/compat/freebsd_network/compat/sys/callout.h (revision 481f986b59e7782458dcc5fe98ad59a57480e5db)
1 /*
2  * Copyright 2010, Axel Dörfler, axeld@pinc-software.de.
3  * Copyright 2009, Colin Günther, coling@gmx.de.
4  * Copyright 2007, Hugo Santos. All Rights Reserved.
5  * Distributed under the terms of the MIT License.
6  */
7 #ifndef _FBSD_COMPAT_SYS_CALLOUT_H_
8 #define _FBSD_COMPAT_SYS_CALLOUT_H_
9 
10 
11 #include <sys/haiku-module.h>
12 
13 #include <sys/queue.h>
14 
15 
16 struct callout {
17 	struct list_link	link;
18 	bigtime_t			due;
19 	uint32				flags;
20 
21 	void *				c_arg;
22 	void				(*c_func)(void *);
23 	struct mtx *		c_mtx;
24 	int					c_flags;
25 };
26 
27 
28 #define CALLOUT_MPSAFE	0x0001
29 
30 
31 void callout_init(struct callout *c, int mpsafe);
32 void callout_init_mtx(struct callout *c, struct mtx *mutex, int flags);
33 int	callout_schedule(struct callout *c, int when);
34 int	callout_reset(struct callout *c, int when, void (*func)(void *), void *arg);
35 int callout_pending(struct callout *c);
36 int callout_active(struct callout *c);
37 
38 #define	callout_drain(c)	_callout_stop_safe(c, 1)
39 #define	callout_stop(c)		_callout_stop_safe(c, 0)
40 int	_callout_stop_safe(struct callout *c, int safe);
41 
42 
43 
44 #endif	/* _FBSD_COMPAT_SYS_CALLOUT_H_ */
45