Use case : multiple commands that can be launched in parallel may attempt to write to the same file.
Current code goes something like this :
var file = DOpus.FSUtil.OpenFile(logFile, "rwo");
// Some loop here
// ... things happen
file.Seek(0, "e"); // to write at the end of the file
file.Write("something\n");
file.Close(); // Doesn't seem to have any effect on the concurrent access wether here or at the end of the loop
// End of loop
At some point two instances will get the file approximately at the same time, will get the same write cursor position, and the latest will overwrite what the first wrote to file.
I could not find anything related to getting exclusive lock on file write in the functions on File object.
Is this possible ? Any idea how ?
Thanks in advance.