From 6a214973e2898cadf1f65bb864d903372086acf1 Mon Sep 17 00:00:00 2001 From: lesismal Date: Thu, 19 Oct 2023 10:35:44 +0800 Subject: [PATCH] kqueue: fix write event --- poller_kqueue.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/poller_kqueue.go b/poller_kqueue.go index 9b785c45..5a38d4a3 100644 --- a/poller_kqueue.go +++ b/poller_kqueue.go @@ -108,6 +108,13 @@ func (p *poller) addRead(fd int) { p.trigger() } +func (p *poller) resetRead(fd int) { + p.mux.Lock() + p.eventList = append(p.eventList, syscall.Kevent_t{Ident: uint64(fd), Flags: syscall.EV_DISABLE, Filter: syscall.EVFILT_WRITE}) + p.mux.Unlock() + p.trigger() +} + func (p *poller) modWrite(fd int) { p.mux.Lock() p.eventList = append(p.eventList, syscall.Kevent_t{Ident: uint64(fd), Flags: syscall.EV_ADD, Filter: syscall.EVFILT_WRITE})