diff options
author | Stacey Son <sson@FreeBSD.org> | 2009-09-16 03:37:39 +0000 |
---|---|---|
committer | Stacey Son <sson@FreeBSD.org> | 2009-09-16 03:37:39 +0000 |
commit | 1a921c410a4a40e17eb05a0be52c3891998579bf (patch) | |
tree | c8f77010c00765957949cb95c1bd2b67c052cff1 /sys/kern/kern_event.c | |
parent | 2c2e449905a27d1a3f56dc71539cc9f81c5c13e4 (diff) | |
download | src-1a921c410a4a40e17eb05a0be52c3891998579bf.tar.gz src-1a921c410a4a40e17eb05a0be52c3891998579bf.zip |
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)
Notes
Notes:
svn path=/head/; revision=197242
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 92afec2b0b05..263089477057 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 |