Refactor Threadpool class

Part of #4 issue.
Latch may be useful in other parts of the project for making synchronization points. Maybe it should be added as a new module in nfCommon? What do you think?