use atomic operations and not locks