sample code demonstrating multithreading programming issues