pthread_once() moved to separate file. pthread_detach(), and pthread_join() routines added, and sleep now sleeps only the running thread not the process.