All the code here is from: Programming with POSIX ® Threads By: David R. Butenhof