Simplify the atomic lock to just write a value of 1 to the lock instead of taking the value passed by the caller (which just confused things).