Files
Nim/tests/async/testmanyasyncevents.nim
Andreas Rumpf 1854d29781 scoped memory management (#14790)
* fixes the regressions
* closes #13936
* scope based memory management implemented
* enabled tcontrolflow.nim test case
* final cleanups
2020-07-04 07:37:24 +02:00

25 lines
503 B
Nim

discard """
output: '''
hasPendingOperations: false
triggerCount: 100
'''
disabled: "windows"
"""
import asyncDispatch
var triggerCount = 0
var evs = newSeq[AsyncEvent]()
for i in 0 ..< 100: # 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