After the [other forum post](https://forum.nim-lang.org/t/10427) wanting to 
efficiently execute a proc at a delayed time I figured I might as well start 
learning a bit more about async. I have a few rather beginner questions 
concerning async in nim. For now I just want to explore a bit based on the 
following code-snippet for which I have a couple questions:
    
    
    import std/[asyncdispatch]
    
    let echoMe: Callback = proc(fd: AsyncFD): bool =
      echo "Me"
      return true
    
    addTimer(100, true, echoMe)
    poll()
    
    
    Run

  1. What is AsyncFD in terms of meaning? (I'm aware it's a distinct int32, but 
what does that mean?)
  2. Why does a Callback need to return a boolean? What does it mean to return 
true/false?
  3. Why does the callback above only execute echoMe once? Shouldn't it do that 
5 times given that poll lasts 500ms and the "true" parameter of addTimer means 
it gets repeated?
  4. Does poll basically say "I'll wait for the next 500ms and process any 
async-events that get thrown during that timeframe, with addTimer being a 
source of AsyncEvents?"
  5. Is there any way to do this in a way that means I don't have to call poll 
because the sources I'm skimming through atm make it sound like that would be 
the task of a runtime to do manage that sort of thing


Reply via email to