Make do_block use poll() rather than select() (based on a patch by