Vas*_*sya 13 .net c# synchronization
我需要使用命名事件来同步两个应用程序.但AutoResetEvent和ManualResetEvent都不包含带有事件名称的构造函数(仅初始状态).我可以通过AutoResetEvent或ManualResetEvent类中的静态方法OpenExisting打开现有的命名事件,但无法创建它!我不想为它使用原生的WinAPI CreateEvent函数,除非我确切地知道其他方法不存在.
Vas*_*sya 27
我自己找到了解决方案.那是:
EventWaitHandle handle =
new EventWaitHandle(false, EventResetMode.ManualReset, "testRemoteServer");
Run Code Online (Sandbox Code Playgroud)