When a plugin allows for saving its state to a file (outside of the host DAW’s mechanisms), there seems to be a need to synchronize this when there’s a potential for multiple instances writing to the same file.
I noticed in PropertiesFile, an InterProcessLock allows for synchronizing the writing of properties, and this makes sense since the nature of the data written to this file might involve reacting to multiple simultaneous programmatic events. In the previous scenario, file saving can only be done by user-actions, which in practice should mean that directing multiple instances to save to the same file should be physically impossible.
This brings me to a few questions:
- Is it even necessary to synchronize multiple plugin instances from writing to the same file for this basic use case ?
- When using JUCE objects (such as TemproraryFile) to write files, is there still potential for data race from another plugin instance?
- What are the conventional/practical approaches for synchronizing file objects from multiple instance writes ? On top of normal locks, should these approaches also involve InterProcessLocks ?