Sample code from How-To book on thread and multithreading