> how can I simultaneously wait over 2 AsyncPipes?

It's a bit low level, but you can use or from asyncFutures

[https://nim-lang.org/docs/asyncfutures.html#or%2CFuture%5BT%5D%2CFuture%5BY%5D](https://nim-lang.org/docs/asyncfutures.html#or%2CFuture%5BT%5D%2CFuture%5BY%5D)

This is rough pseudo code, but you would use it something like this: 
    
    
    proc doingAsyncStuff {.async.} =
      let pipeFuture1 = someOtherAsyncProc() # you would replace this with your 
async pipes.
      let pipeFuture2 = someOtherAsyncProc()
      # this will await until one of the futures is ready. (You can also use 
`and` if you want to wait for both)
      await (pipeFuture1 or pipeFuture2)
      # This is the low level stuff.
      # we don't know which future actually finished, so we have to check 
manually.
      if pipeFuture1.finished() :
        let val = pipeFuture1.read()
        # do stuff
      else if pipeFuture2.finished() :
        let val = pipeFuture2.read()
        # do other stuff
    
    
    Run

Reply via email to