Do you know what I could use right now? A buffered output channel that flushes only when explicitly flushed by the program. Does #OCaml have this? I.e. out_channels that don't get full.
Application: receive printable data from parallel workers and print each line uninterrupted.
We need to read all the data available from each worker so they don't get stuck in the middle of a long line but only print the data one whole line at a time.
A key function we need is:
val read_available_lines : Buffer.t -> string list