func compareAndSwap()

in MobiusCore/Source/Lock.swift [50:59]


    func compareAndSwap(expected: Value, with newValue: Value) -> Bool {
        var success = false
        self.mutate { value in
            if value == expected {
                value = newValue
                success = true
            }
        }
        return success
    }