My project involves a plugin, and a GUI for said plugin which is isolated into a separate process. The data I'm sharing may be updated by the GUI, and when it is, it should be processed by the plugin.
To do this, I'm considering putting this in my shared-memory block:
std::atomic_bool event_flag; // insert mutex... some_data_struct data; In essence, the GUI does the following when it wants to change the data:
// acquire mutex // write data... // release mutex event_flag = true; event_flag.notify_one(); Then the plugin does the following:
event_flag.wait(true); event_flag = false; // acquire mutex // read data... // release mutex