Test + fix for epoll and kqueue selector modules to properly unregister

event handles that have the key type "User"
This commit is contained in:
Ray Imber 2019-10-06 16:02:12 -07:00
commit adc1419499
3 changed files with 26 additions and 3 deletions

View file

@ -0,0 +1,23 @@
discard """
output: '''
hasPendingOperations: false
triggerCount: 512
'''
"""
import asyncDispatch
var triggerCount = 0
var evs = newSeq[AsyncEvent]()
for i in 0 ..< 512: # has to be lower than the typical physical fd limit
var ev = newAsyncEvent()
evs.add(ev)
addEvent(ev, proc(fd: AsyncFD): bool {.gcsafe,closure.} = triggerCount += 1; true)
for ev in evs:
ev.trigger()
drain()
echo "hasPendingOperations: ", hasPendingOperations()
echo "triggerCount: ", triggerCount