I am coding to avoid some Multi-Threading errors using the code displayed in your help guide. I am accessig a file objects from several strategies at the same time but I still get Multi-Threading issues.
The code I use is as simple as the one you show in your site:
private object lockObj = new object();
private void CreateFile()
{
lock (lockObj)
{
string fileName = @"C:\Folder\File.txt";
FileInfo f_info = new FileInfo( fileName );
if (f_info.Exists)
f_info.Delete();
mFile = f_info.CreateText();
CloseLog();
}
}
private void CloseLog()
{
if (mFile != null)
{
mFile.Flush();
mFile.Close();
mFile = null;
}
}
Any help about this?
Thanks
Comment