pipe: simplify signal handling in pipe_read() and add comments