aboutsummaryrefslogtreecommitdiffstats
path: root/env-vars.txt
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-03-19 19:00:54 -0700
committerChris Robinson <[email protected]>2014-03-19 19:00:54 -0700
commit168149ce9daedb2e3d9a11b7fee2b22b2e4daf7a (patch)
tree53df1cd7169aa870f93d7cb72e641815a67133aa /env-vars.txt
parent0c5cbafcd84df288c7f41e0ef06c9e3109b03365 (diff)
Keep track of the mix count
The purpose of this is to provide a safe way to be able to "swap" resources used by the mixer from other threads without the need to block the mixer, as well as a way to track when mixes have occurred. The idea is two-fold: It provides a way to safely swap resources. If the mixer were to (atomically) get a reference to an object to access it from, another thread would be able allocate and prepare a new object then swap the reference to it with the stored one. The other thread would then be able to wait until (count&1) is clear, indicating the mixer is not running, before safely freeing the old object for the mixer to use the new one. It also provides a way to tell if the mixer has run. With this, a thread would be able to read multiple values, which could be altered by the mixer, without requiring a mixer lock. Comparing the before and after counts for inequality would signify if the mixer has (started to) run, indicating the values may be out of sync and should try getting them again. Of course, it will still need something like a RWLock to ensure another (non-mixer) thread doesn't try to write to the values at the same time. Note that because of the possibility of overflow, the counter is not reliable as an absolute count.
Diffstat (limited to 'env-vars.txt')
0 files changed, 0 insertions, 0 deletions