> Chronos has an eternally ongoing poll call that never times out

`chronos` poll returns after it has processed one round of callbacks - thus, 
you can use a timer to make it return on a regular basis like so (`waitFor` 
calls `poll`):
    
    
    import chronos
    
    proc work(v: int) {.async.} =
      echo "before ", v
      await sleepAsync(1.seconds)
      echo "after ", v
    
    var v = 0
    while true:
      waitFor sleepAsync(500.milliseconds)
      echo "Starting task"
      asyncSpawn work(v)
      inc v
    
    
    Run

Reply via email to