Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
pilot committed Oct 11, 2023
1 parent b8e0606 commit a5dc367
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions epoll.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const (
maxUint32 = 0xFFFFFFFF
)

var fdEvPool = sync.Pool{
var evPool = sync.Pool{
New: func() any {
return new(fdEvent)
},
Expand Down Expand Up @@ -58,7 +58,7 @@ func (ep *poller) add(ev *Event) error {
if ok {
op = syscall.EPOLL_CTL_MOD
} else {
es = fdEvPool.Get().(*fdEvent)
es = evPool.Get().(*fdEvent)
ep.fdEvents[ev.fd] = es
}

Expand Down Expand Up @@ -102,7 +102,7 @@ func (ep *poller) del(ev *Event) error {
op := syscall.EPOLL_CTL_DEL
if es.evs&(syscall.EPOLLIN|syscall.EPOLLOUT) == 0 {
delete(ep.fdEvents, ev.fd)
fdEvPool.Put(es)
evPool.Put(es)
} else {
op = syscall.EPOLL_CTL_MOD
}
Expand Down

0 comments on commit a5dc367

Please sign in to comment.