On Tue, 6 May 2025 14:52:49 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> I've moved the `fireValueChangedIfNecessary` out of the synchronized block. 
>> We need the synchronized block as a memory barrier to see the latest value 
>> of the `effectiveValue` field, as we need to be able to read it from any 
>> thread.
>
> Maybe a `volatile` would be a better choice then?

`volatile` is not enough, because the different values are correlated (for 
example `foreground`, `background`, and `colorScheme`). All values need to be 
updated in a single transaction, as otherwise we could end up reading a 
transient combination of values.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1655#discussion_r2076061396

Reply via email to