Threading Problem

Changed thread A. The Same changes will have to be made with the rest of the threads.