engine.py: Rewrite producer-consumer to not use .wait() and Task.cancel().

Closes chfoo/wpull#168