public override int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
 {
     if (_dispatcher._disableProcessingCount > 0)
     {
         // Call into native code directly in order to avoid the default
         // CLR locking behavior which pumps messages under contention.
         // Even though they try to pump only the COM messages, any
         // messages that have been SENT to the window are also
         // dispatched.  This can lead to unpredictable reentrancy.
         return(MS.Win32.UnsafeNativeMethods.WaitForMultipleObjectsEx(waitHandles.Length, waitHandles, waitAll, millisecondsTimeout, false));
     }
     else
     {
         return(SynchronizationContext.WaitHelper(waitHandles, waitAll, millisecondsTimeout));
     }
 }
 public static new int WaitHelper(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
 {
     return(SynchronizationContext.WaitHelper(waitHandles, waitAll, millisecondsTimeout));
 }