Source/NFX.Erlang/Connect/ErlLocalNode.cs
/// <summary>
/// Wait for arrival of messages in any one of the given mailboxes
/// </summary>
/// <param name="mboxes">Mailboxes to wait for messages in</param>
/// <param name="msecTimeout">Timeout in milliseconds</param>
/// <returns>Index of the first non-empty mailbox or -1 on timeout</returns>
Wait for arrival of messages in any one of the given mailboxes
Wait for arrival of messages in any one of the given mailboxes
public int WaitAny(ErlMbox[] mboxes, int msecTimeout = -1)
    {
      for (int i = 0; i < mboxes.Length; i++)
        if (!mboxes[i].Empty)
          return i;
      if (msecTimeout == 0)
        return -1;
      int n = WaitHandle.WaitAny(mboxes.Select(m => m.Handle).ToArray(), msecTimeout);
      return n == WaitHandle.WaitTimeout ? -1 : n;
    }
public int WaitAny ( ErlMbox [ ] mboxes , int msecTimeout = - 1 ) { for ( int i = 0 ; i < mboxes . Length ; i ++ ) if ( ! mboxes [ i ] . Empty ) return i ; if ( msecTimeout == 0 ) return - 1 ; int n = WaitHandle . WaitAny ( mboxes . Select ( m => m . Handle ) . ToArray ( ) , msecTimeout ) ; return n == WaitHandle . WaitTimeout ? - 1 : n ; }
Wait for arrival of messages in any one of the given mailboxes
Wait for arrival of messages in any one of the given mailboxes
Index of the first non-empty mailbox or -1 on timeout
Index of the first non - empty mailbox or - 1 on timeout
mboxes
ErlMbox[]
Mailboxes to wait for messages in
Mailboxes to wait for messages in
msecTimeout
int
Timeout in milliseconds
Timeout in milliseconds