diff options
author | rrs <rrs@FreeBSD.org> | 2015-03-31 00:18:00 +0000 |
---|---|---|
committer | rrs <rrs@FreeBSD.org> | 2015-03-31 00:18:00 +0000 |
commit | 59d85f7f18387de85439636c5bf714b7bb471220 (patch) | |
tree | 616039f6896fbff03ea5cf41969bcf8bcd98e302 /sys/sys/callout.h | |
parent | 67a59f75f02a181abca07187f88d66a35a43ab21 (diff) | |
download | FreeBSD-src-59d85f7f18387de85439636c5bf714b7bb471220.zip FreeBSD-src-59d85f7f18387de85439636c5bf714b7bb471220.tar.gz |
Adopt jhb's suggested changes, updated comments and callout_migration() moving
to kern/kern_timeout.c
This does *not* address his -1 -> NOCPU comment.
Sponsored by: Netflix Inc.
Diffstat (limited to 'sys/sys/callout.h')
-rw-r--r-- | sys/sys/callout.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/sys/callout.h b/sys/sys/callout.h index ba1c52f..6e18ae7 100644 --- a/sys/sys/callout.h +++ b/sys/sys/callout.h @@ -68,18 +68,18 @@ struct callout_handle { * field is the one that caller operations that may, or may not have * a lock touches i.e. callout_deactivate(). The other, the c_iflags, * is the internal flags that *must* be kept correct on which the - * callout system depend on i.e. callout_migrating() & callout_pending(), - * these are used internally by the callout system to determine which - * list and other critical internal state. Callers *should not* use the - * c_flags field directly but should use the macros! + * callout system depend on e.g. callout_pending(). + * The c_iflag is used internally by the callout system to determine which + * list the callout is on and track internal state. Callers *should not* + * use the c_flags field directly but should use the macros provided. * - * If the caller wants to keep the c_flags field sane they - * should init with a mutex *or* if using the older - * mpsafe option, they *must* lock there own lock - * before calling callout_deactivate(). + * The c_iflags field holds internal flags that are protected by internal + * locks of the callout subsystem. The c_flags field holds external flags. + * The caller must hold its own lock while manipulating or reading external + * flags via callout_active(), callout_deactivate(), callout_reset*(), or + * callout_stop() to avoid races. */ #define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE) -#define callout_migrating(c) ((c)->c_iflags & CALLOUT_DFRMIGRATION) #define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE) #define callout_drain(c) _callout_stop_safe(c, 1) void callout_init(struct callout *, int); |