I am trying to read a line from io in a non-blocking way.
Unfortunately readline blocks. I think I can solve this with read_nonblock with an additional buffer, where I store a partial result, check if there are several lines in the buffer, etc., but this seems a bit complicated for a simple task like this. Is there a better way to do this?
Note: I use event demultiplexing ( select ), and I am very pleased with it, I do not want to create threads, use EventMachine, etc.
Karoly Horvath
source share