Revert r287780 until more developers have their say.
Differential Revision: https://reviews.freebsd.org/D3521 Requested by: gnn
This commit is contained in:
parent
0cf00015be
commit
c55f4c9445
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=288096
@ -1641,7 +1641,6 @@ MLINKS+=timeout.9 callout.9 \
|
||||
timeout.9 callout_active.9 \
|
||||
timeout.9 callout_deactivate.9 \
|
||||
timeout.9 callout_drain.9 \
|
||||
timeout.9 callout_drain_async.9 \
|
||||
timeout.9 callout_handle_init.9 \
|
||||
timeout.9 callout_init.9 \
|
||||
timeout.9 callout_init_mtx.9 \
|
||||
|
@ -36,7 +36,6 @@
|
||||
.Nm callout_active ,
|
||||
.Nm callout_deactivate ,
|
||||
.Nm callout_drain ,
|
||||
.Nm callout_drain_async ,
|
||||
.Nm callout_handle_init ,
|
||||
.Nm callout_init ,
|
||||
.Nm callout_init_mtx ,
|
||||
@ -71,8 +70,6 @@ typedef void timeout_t (void *);
|
||||
.Fn callout_deactivate "struct callout *c"
|
||||
.Ft int
|
||||
.Fn callout_drain "struct callout *c"
|
||||
.Ft int
|
||||
.Fn callout_drain_async "struct callout *c" "callout_func_t *fn" "void *arg"
|
||||
.Ft void
|
||||
.Fn callout_handle_init "struct callout_handle *handle"
|
||||
.Bd -literal
|
||||
@ -267,24 +264,6 @@ fully stopped before
|
||||
.Fn callout_drain
|
||||
returns.
|
||||
.Pp
|
||||
The function
|
||||
.Fn callout_drain_async
|
||||
is non-blocking and works the same as the
|
||||
.Fn callout_stop
|
||||
function.
|
||||
When this function returns non-zero, do not call it again until the callback function given by
|
||||
.Fa fn
|
||||
has been called with argument
|
||||
.Fa arg .
|
||||
Only one of
|
||||
.Fn callout_drain
|
||||
or
|
||||
.Fn callout_drain_async
|
||||
should be called at a time to drain a callout.
|
||||
If this function returns zero, it is safe to free the callout structure pointed to by the
|
||||
.Fa c
|
||||
argument immediately.
|
||||
.Pp
|
||||
The
|
||||
.Fn callout_reset
|
||||
and
|
||||
|
@ -1144,45 +1144,6 @@ callout_schedule(struct callout *c, int to_ticks)
|
||||
return callout_reset_on(c, to_ticks, c->c_func, c->c_arg, c->c_cpu);
|
||||
}
|
||||
|
||||
int
|
||||
callout_drain_async(struct callout *c, callout_func_t *func, void *arg)
|
||||
{
|
||||
struct callout_cpu *cc;
|
||||
struct lock_class *class;
|
||||
int retval;
|
||||
int direct;
|
||||
|
||||
/* stop callout */
|
||||
callout_stop(c);
|
||||
|
||||
/* check if callback is being called */
|
||||
cc = callout_lock(c);
|
||||
if (c->c_iflags & CALLOUT_DIRECT) {
|
||||
direct = 1;
|
||||
} else {
|
||||
direct = 0;
|
||||
}
|
||||
retval = (cc_exec_curr(cc, direct) == c);
|
||||
|
||||
/* drop locks, if any */
|
||||
if (retval && c->c_lock != NULL &&
|
||||
c->c_lock != &Giant.lock_object) {
|
||||
/* ensure we are properly locked */
|
||||
class = LOCK_CLASS(c->c_lock);
|
||||
class->lc_assert(c->c_lock, LA_XLOCKED);
|
||||
/* the final callback should not be called locked */
|
||||
c->c_lock = NULL;
|
||||
c->c_iflags |= CALLOUT_RETURNUNLOCKED;
|
||||
}
|
||||
CC_UNLOCK(cc);
|
||||
|
||||
/* check if we should queue final callback */
|
||||
if (retval)
|
||||
callout_reset(c, 1, func, arg);
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
int
|
||||
_callout_stop_safe(struct callout *c, int safe)
|
||||
{
|
||||
|
@ -46,8 +46,6 @@ LIST_HEAD(callout_list, callout);
|
||||
SLIST_HEAD(callout_slist, callout);
|
||||
TAILQ_HEAD(callout_tailq, callout);
|
||||
|
||||
typedef void callout_func_t(void *);
|
||||
|
||||
struct callout {
|
||||
union {
|
||||
LIST_ENTRY(callout) le;
|
||||
|
@ -82,7 +82,6 @@ struct callout_handle {
|
||||
#define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE)
|
||||
#define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE)
|
||||
#define callout_drain(c) _callout_stop_safe(c, 1)
|
||||
int callout_drain_async(struct callout *, callout_func_t *, void *);
|
||||
void callout_init(struct callout *, int);
|
||||
void _callout_init_lock(struct callout *, struct lock_object *, int);
|
||||
#define callout_init_mtx(c, mtx, flags) \
|
||||
|
Loading…
Reference in New Issue
Block a user