I think you intended to lock a mutex here. If not, you should.