In the other thread, doSnapshot is protected by the mutex. You should also protect it here.