Protect read and write of generator statistics using mutex