xref: /haiku/src/libs/compat/freebsd_network/compat/sys/callout.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
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 #include <sys/_callout.h>
13 
14 
15 #define	CALLOUT_MPSAFE			0x0008 /* deprecated */
16 #define	CALLOUT_RETURNUNLOCKED	0x0010 /* handler returns with mtx unlocked */
17 
18 
19 void callout_init(struct callout *c, int mpsafe);
20 void callout_init_mtx(struct callout *c, struct mtx *mutex, int flags);
21 int callout_schedule(struct callout *c, int _ticks);
22 int callout_reset(struct callout *c, int _ticks, void (*func)(void *), void *arg);
23 int callout_pending(struct callout *c);
24 int callout_active(struct callout *c);
25 
26 #define callout_reset_on(c, to_ticks, fn, arg, cpu) \
27 	callout_reset(c, to_ticks, fn, arg)
28 
29 #define	callout_drain(c)	_callout_stop_safe(c, 1)
30 #define	callout_stop(c)		_callout_stop_safe(c, 0)
31 int	_callout_stop_safe(struct callout *c, int safe);
32 
33 
34 
35 #endif	/* _FBSD_COMPAT_SYS_CALLOUT_H_ */
36