Improve efficiency and flexibility of threadpool/workqueue API

This is a good candidate for using Rust, since it's an efficiency win more than anything else.