in reply to Re^2: Suffering with buffering - how to wake 'less'
in thread Suffering with buffering - how to wake 'less'

What is buf(.pl) doing that prevents 'less' from stopping it?

Nothing. buf's output thread is still blocking at the same spot as the producer would without buf.

less stops reading when it has enough to display what it needs to display. The producer doesn't know or care when that happens, so it keeps adding to the pipe until it fills up. Trying to add more to the pipe, the producer blocks until less starts emptying it.

buf reads all that it can as fast as it can. That's likely to be faster than the producer can produce output, so the pipe from the producer never fills, so the producer never blocks. buf keeps the lines it read in a Queue from where the writer will fetch them when it unblocks.