Modified threads3. Now using a common object to do synchronisation between the threads.