Sample code demonstrating multithreading programming issues