Here is the context: I made a Qt5 program to drive a sourcemeter, it applies an electrical signal to a sample and measures its reaction, plotting data to matplotlib in real time. It looks like this:
Plotting is done by the main thread, measuring/applying is done in another thread so that display does not slow down measurements.
The program also has a button to take all the available data from the plot and store it in a .csv file, but I'm considering having it write the values one by one in real time instead. I would like to add an optional input for the user to add description, so the stored data would be the actual I/V/time columns sometimes interrupted by text like "t=60, the sample smells funny". Writing the description line to the file would be easy, it's just a push button connected to a tiny function. The problem is that my file is already open somewhere else. Is that a problem at all?, I actually don't know, and if yes:
How do I safely write this additional description text from the main thread, while the file is opened by the measurements thread?
Thanks in advance.