Added the mutex to the threads.