碰到一个问题:

需求是:对于同一个app,可以创建多个进程instance。如果一个进程instance已经启动并正在使用一个temp file, 这个temp file作为进程间exclusive使用的资源,是不允许被其他这个app的进程instance所访问的。

方法:使用System.Threading.Mutex创建系统mutex--相当于进程级别的全局变量。

In fixing。。。。。。。。。。。。。。。。。。。。。。。。。。。。

学到的:

The System.Threading namespace provides classes and interfaces that enable multithreaded programming. In addition to classes for synchronizing thread activities and access to data ( Mutex, Monitor, Interlocked, AutoResetEvent, and so on), this namespace includes a ThreadPool class that allows you to use a pool of system-supplied threads, and a Timer class that executes callback methods on thread pool threads.

Mutex

Monitor


相关文章:

  • 2022-12-23
  • 2022-01-17
  • 2021-12-04
  • 2021-06-19
  • 2021-10-03
  • 2021-12-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-09
  • 2021-10-29
  • 2021-05-09
  • 2021-09-02
  • 2021-08-31
  • 2022-12-23
相关资源
相似解决方案