How to wait on multiple file descriptors/streams

Hello all,

I’m trying to read from multiple sockets/file descriptors, and would like to wait for either of them to have available bytes, then read them, and go back to waiting. In a regular posix system, I would use select, or (e)poll to determine which descriptor has data, but it seems that Julia doesn’t have a utility function to do that.

I tried using tasks to read from all sockets in asnyc threads, but not surprisingly, the read does not yield, but blocks the process instead. I would very much like to avoid an inifinite loop in which I poll the sockets with timeout values, that would be very inelegant.

I also tried searching the community discussions and the web in general for a solution, but nothing appropriate came up. Any ideas or hints?