diff options
author | sson <sson@FreeBSD.org> | 2009-09-16 03:37:39 +0000 |
---|---|---|
committer | sson <sson@FreeBSD.org> | 2009-09-16 03:37:39 +0000 |
commit | a386443e5123201c31ec7a193e83f022ede7f469 (patch) | |
tree | c8f77010c00765957949cb95c1bd2b67c052cff1 /sys/kern/kern_event.c | |
parent | 7cb0718a03501c7ac46ff447e23b5aa2a3bd3928 (diff) | |
download | FreeBSD-src-a386443e5123201c31ec7a193e83f022ede7f469.zip FreeBSD-src-a386443e5123201c31ec7a193e83f022ede7f469.tar.gz |
Add the EV_DISPATCH flag to kevents.
When the EV_DISPATCH flag is used the event source will be disabled
immediately after the delivery of an event. This is similar to the
EV_ONESHOT flag but it doesn't delete the event.
Approved by: rwatson (co-mentor)
Diffstat (limited to 'sys/kern/kern_event.c')
-rw-r--r-- | sys/kern/kern_event.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 92afec2..2630894 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1445,15 +1445,17 @@ start: *kevp = kn->kn_kevent; KQ_LOCK(kq); KQ_GLOBAL_UNLOCK(&kq_global, haskqglobal); - if (kn->kn_flags & EV_CLEAR) { + if (kn->kn_flags & (EV_CLEAR | EV_DISPATCH)) { /* * Manually clear knotes who weren't * 'touch'ed. */ - if (touch == 0) { + if (touch == 0 && kn->kn_flags & EV_CLEAR) { kn->kn_data = 0; kn->kn_fflags = 0; } + if (kn->kn_flags & EV_DISPATCH) + kn->kn_status |= KN_DISABLED; kn->kn_status &= ~(KN_QUEUED | KN_ACTIVE); kq->kq_count--; } else |