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 /* Time values are in ticks, see compat/sys/kernel.h for its definition */ 34 int callout_schedule(struct callout *c, int ticks); 35 int callout_reset(struct callout *c, int ticks, void (*func)(void *), void *arg); 36 int callout_pending(struct callout *c); 37 int callout_active(struct callout *c); 38 39 #define callout_drain(c) _callout_stop_safe(c, 1) 40 #define callout_stop(c) _callout_stop_safe(c, 0) 41 int _callout_stop_safe(struct callout *c, int safe); 42 43 44 45 #endif /* _FBSD_COMPAT_SYS_CALLOUT_H_ */ 46