For an example how I did see [https://github.com/nim-lang/Nim/blob/devel/tools/downloader.nim](https://github.com/nim-lang/Nim/blob/devel/tools/downloader.nim)
Esp this section: pollingMainLoop((proc (timeout: int) = if hasPendingOperations(): asyncdispatch.poll(timeout)), 10) Run But beware: This code is old and was never used in production.