Allow canceling out of the reading loop.
Added SIGWINCH handling.