Logic tweaks.

Don’t need to check if the writer is available before writing, because we flush
after each write, which is guaranteed to empty the buffer and thus the writer
will always be available (for at least one write). Also, we always need to flush
before filling the reader, as filling the reader overwrites its buffer.

(If you want to flush and fill in parallel, you need to make a separate copy of
the read buffer so that it doesn’t get overwritten before the flush.)