I have a shared variable DISPLAY_LEVEL
that is created/used by my app, and is almost never written to, but is constantly read from the UI. The variable can be written to from several threads.
I do not care if reading this variable sometimes returns stale out of date values, as long as the values it does return are within the range of expected values.
Because the variable is generated by the user, I can't make it a static variable. As a first pass, I am using an Arc<AtomicU64>
, however, given how constantly this value is read, I wonder if this is too much overhead. (It needs to be 64bit, not 8 bit for reasons that aren't important here). Are there any suggestions on how I can optimize this, keeping in mind that it is essentially almost readonly, and will be changed only a few times or potentially never?