Basic lock and atomicity examples