Replaced latch with atomic integer.