vertx / io.vertx.reactivex.core.shareddata / Counter / compareAndSet

# compareAndSet

`open fun compareAndSet(expected: Long, value: Long, resultHandler: Handler<AsyncResult<Boolean>>): Unit`

Set the counter to the specified value only if the current value is the expectec value. This happens atomically.

### Parameters

`expected` - the expected value

`value` - the new value

`resultHandler` - the handler will be passed true on success