title: Wait until all processes notified after EventWaitHandle.Set()
body: <p>I do in one <em>process</em>:</p>
  
  <pre><code>_eventWaitHandle.Set();
  _eventWaitHandle.Reset();
  </code></pre>
  
  <p>In another <em>process</em>:</p>
  
  <pre><code>_eventWaitHandle.WaitOne();
  Console.WriteLine("Hello");
  </code></pre>
  
  <p>But never get notified (no console output).
  It seem that Set in asynchronous.</p>
  
  <p><strong>How can I wait until all waiters were signaled before doing Reset()?</strong></p>
  
  <p>I create wait handle (<em>NAMED inter process wait handle</em>):</p>
  
  <pre><code>    internal static EventWaitHandle OpenExistingOrCreateEventWaitHandle(string name)
      {
          try
          {
              return EventWaitHandle.OpenExisting(name);
          }
          catch (WaitHandleCannotBeOpenedException)
          {
              return new EventWaitHandle(false, EventResetMode.ManualReset, name);
          }
      }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>For now I have one "solution"</p>
  
  <pre><code>_eventWaitHandle.Set();
  Thread.Sleep(10);
  _eventWaitHandle.Reset();
  </code></pre>
  
  <p>Second possible - to have many handles for each process. But this code should work in any office application add-in or standalone app. So names should be generated some how and discovered.</p>
  
  <p>Third - to use WCF p2p(netPeerTcpBinding) or named pipes with UdpDiscoveryEndpoint- but these use "IP" so can have some security issues when deployed to end users?</p>