Question: Is there a variant of `MutableStateFlow.compareAndSet(expect, update)` where `update` is e...
c
Question: Is there a variant of
MutableStateFlow.compareAndSet(expect, update)
where
update
is evaluated lazily?
As far as I can see the answer is no, but this surprises me somewhat because it seems like it would be useful. Unless I’m missing some obvious problem?
e
that would require locking whereas CAS can be done with lockless atomic constructs
c
ok thanks for the insight!