Source/NFX.Erlang/Connect/ErlLocalNode.cs
/// <summary>
/// Create an Erlang <see cref="ErlPid"/>. Erlang pids are based
/// upon some node specific information; this method creates a pid
/// using the information in this node. Each call to this method
/// produces a unique pid
/// </summary>
Create an Erlang . Erlang pids are based
upon some node specific information; this method creates a pid
using the information in this node. Each call to this method
produces a unique pid
Create an Erlang . Erlang pids are based upon some node specific information ; this method creates a pid using the information in this node . Each call to this method produces a unique pid
internal ErlPid CreatePid()
    {
      int n;
      while (true)
      {
        n = Interlocked.Increment(ref m_PidCount);
        if (n < (1 << 28))
          break;
        if (Interlocked.CompareExchange(ref m_PidCount, 1, n) == n)
        {
          n = 1;
          break;
        }
      }
      return new ErlPid(NodeName, n, m_Creation);
    }
internal ErlPid CreatePid ( ) { int n ; while ( true ) { n = Interlocked . Increment ( ref m_PidCount ) ; if ( n < ( 1 << 28 ) ) break ; if ( Interlocked . CompareExchange ( ref m_PidCount , 1 , n ) == n ) { n = 1 ; break ; } } return new ErlPid ( NodeName , n , m_Creation ) ; }
Create an Erlang .
Create an Erlang .
// The label handles conditional jump in a very rare case of an overflow // TODO: need to deal with pid numbering in case of large number of pids // when ID+Serial exceeds 18 bits.