* Made callout_pending() and callout_active() real functions instead of macros;
that makes drivers using it more independent from internal net_timer changes. * Correctly implemented callout_active() using the new is_timer_running() stack function. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27632 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
491da20dbf
commit
d3ae536bb9
@ -27,6 +27,9 @@ handle_callout(struct net_timer *timer, void *data)
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
void
|
||||
callout_init_mtx(struct callout *c, struct mtx *mtx, int flags)
|
||||
{
|
||||
@ -63,3 +66,17 @@ _callout_stop_safe(struct callout *c, int safe)
|
||||
return gStack->cancel_timer(&c->c_timer) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
callout_pending(struct callout *c)
|
||||
{
|
||||
return gStack->is_timer_active(&c->c_timer);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
callout_active(struct callout *c)
|
||||
{
|
||||
return gStack->is_timer_running(&c->c_timer);
|
||||
}
|
||||
|
||||
|
@ -22,16 +22,14 @@ struct callout {
|
||||
#define CALLOUT_MPSAFE 0x0001
|
||||
|
||||
void callout_init_mtx(struct callout *c, struct mtx *mutex, int flags);
|
||||
int callout_reset(struct callout *, int, void (*)(void *), void *);
|
||||
int callout_reset(struct callout *c, int, void (*func)(void *), void *arg);
|
||||
int callout_pending(struct callout *c);
|
||||
int callout_active(struct callout *c);
|
||||
|
||||
#define callout_drain(c) _callout_stop_safe(c, 1)
|
||||
#define callout_stop(c) _callout_stop_safe(c, 0)
|
||||
int _callout_stop_safe(struct callout *, int);
|
||||
|
||||
#define callout_pending(c) ((c)->c_timer.due > 0)
|
||||
#define callout_active(c) ((c)->c_timer.due == -1)
|
||||
// TODO: there is currently no way to find out about this!
|
||||
|
||||
|
||||
static inline void
|
||||
callout_init(struct callout *c, int mpsafe)
|
||||
|
Loading…
Reference in New Issue
Block a user