Refactor to use dispatch_io for tasks, and wait for EOF

Hopefully resolves #139, #135, #161.

/cc @joshaber @keithduncan
The docs say 0. I think you're referring to a Carbon-era constant. :stuck_out_tongue: