Improved thread-pool task joining
Removed spurious debug messages.
Change to use condition vaiable from mutex.