Tue 11 Mar 2014 05:16:11 PM UTC, original submission:
Currently I am running several shell scripts at the same time in parallel on a multi-core system. These also call octave to create some plots.
When it comes to plotting to a bitmap file the results get mixed up.
The reason is that the plot command creates temporary files whose names are just numbered per session (1, 2, ...)
If two octave sessions are running at the same time, chances are that they want to use the same file which fails or that a later run overwrites the temporary plot file.
To repair this, the temporary file names would have to be unique. At least to a high degree of probability, e.g. using the rand() function.
A better approach would be to create a file name, test for its existence and if so, increment a counter, otherwise create the file to "reserve" it.
The current code uses tmpnam() which should be replaced (probably tmpnam () should be modified to create at least a pseudo unique file name.
The following example shows the temporary file name (oct-7.eps):
|