use atomic int in lock