Tracktion / tracktion_engine

Tracktion Engine module
Other
1.11k stars 148 forks source link

Refactor LockFreeObject to use RCU #200

Open drowaudio opened 2 months ago

drowaudio commented 2 months ago

There is a problem with using LockFreeObject in LockFreeMultiThreadedNodePlayer in that the old node will stay around until the new node is pushed. This is mostly benign apart from some space usage but causes a real problem when Nodes use RAII.

An example of this is MidiInputDeviceNode which unregisters itself as a Consumer in the destructor. If there are always two of these nodes alive for each input device, multiple handleIncomingMidiMessage callbacks will happen for the device and notes will be doubled.

We really need to rely on only one Node being active at each time point.