static Mutex myMutex = new Mutex();
 
 
 static public bool writeLine(string instr,string fileName)
{
  myMutex.WaitOne();
 
  .......[做文件读写就行了]
 
  myMutex.ReleaseMutex();
}

  

 private System.Object lockThis = new System.Object();
 lock (lockThis)
        {
            // Access thread-sensitive resources.
        }

  

相关文章:

  • 2021-05-04
  • 2021-07-25
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
猜你喜欢
  • 2022-12-23
  • 2021-06-13
  • 2022-01-22
  • 2022-12-23
  • 2021-04-26
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案