Mstm.WriteToFile method

Options

how this method will handle writing to file when we set engine to couple of threads and same events (which fires same function that write to same file) will occure in same time?

 

when we use this function in exe application and run it twice - second instance of application will throw exception that says file is in use.

Tagged:

Comments

  • If the write occurs in a system action, for a singkle engine environment and a correctly configured multi-engine environment (assuming a shared directory for the file to be written to), there should be no problem since system actions occure in sequence.

     

    If the write occurs within a user action, it is possible for two users to attempt a write at the same time, I believe (but have not proved). In this case, as with any other application, it would be best to wrap some exception handling code around the write itself.

  • or maybe function should use lock statement:

    Object thisLock = new Object();
    lock (thisLock)
    {
        // Critical code section
    }