You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some key global data structures that have static lifetime.
E.g, AUDIO_STATE, RESET_STATE.
Atomics are simpler, easier to use, more performant, and won't ever deadlock.
Although these global structures aren't fully compatible with atomics, and there will be data races if the whole structure isn't updated atomically, e.g:
GUI requests to clear queue and stop playback
Audio clears AUDIO_STATE's` queue
GUI reads AUDIO_STATE, empty queue but still playing?
Audio sets playing to false
The whole struct should be updated at once before any other thread can read it as a whole.
Todo
Either shard the current structures in a well defined way, or use something like AtomicCell.
The text was updated successfully, but these errors were encountered:
What
There are some key global data structures that have
static
lifetime.E.g,
AUDIO_STATE
,RESET_STATE
.Atomics are simpler, easier to use, more performant, and won't ever deadlock.
Although these global structures aren't fully compatible with atomics, and there will be data races if the whole structure isn't updated atomically, e.g:
GUI
requests to clear queue and stop playbackAudio
clearsAUDIO_STATE
's` queueGUI
readsAUDIO_STATE
, empty queue but still playing?Audio
setsplaying
tofalse
The whole struct should be updated at once before any other thread can read it as a whole.
Todo
Either shard the current structures in a well defined way, or use something like
AtomicCell
.The text was updated successfully, but these errors were encountered: