Add generators functionality to the threading part.
Cosmetic changes on gevent part.