Fix coverity issue - Check of thread-shared field evades lock acquisition