pthread-based threadpool implementation and test cases