Thanks for your reply, David. I think I didn't do that search because I had google blinders saying "while read". My fault, anyway.
Now that could work for my needs but I need to be able to set a timeout for the read operation. Is it possible to do that? Perhaps with some black magic signals/killing trickery somehow?