I have an implementation of a bi-directional message channel which, to reduce overhead, I implemented as a couple of circular buffers of messages. To write from one end to t
It's a bit of a hack, but you could replace your condition variable with a pipe. The read thread would poll/select on the read side and the socket. The thread that writes to your buffer also writes a byte to the pipe to signal there is stuff in the buffer.