securing total_threads with the mutex while destroying the processor