/// <summary>
 ///
 /// </summary>
 public virtual void OnRemoveFromArbiter()
 {
     lock (this)
     {// Lock needed to assure operations go together.
         _arbiterSlim      = null;
         _arbiterSlimIndex = -1;
     }
 }
        /// <summary>
        ///
        /// </summary>
        public bool Send(Envelope envelope)
        {
            ArbiterSlim slim = _arbiterSlim;

            if (slim != null)
            {
                envelope.SenderArbiterSlimIndex = this.ArbiterSlimIndex;
                return(_arbiterSlim.Send(this._arbiterSlimIndex, envelope));
            }

            return(false);
        }
        /// <summary>
        ///
        /// </summary>
        public virtual bool OnAddToArbiter(ArbiterSlim arbiter, int arbiterIndex)
        {
            if (_arbiterSlim != null)
            {
                return(false);
            }

            lock (this)
            {// Lock needed to assure operations go together.
                _arbiterSlimIndex = arbiterIndex;
                _arbiterSlim      = arbiter;
            }

            return(true);
        }
 /// <summary>
 /// Construction helper.
 /// </summary>
 void Construct()
 {
     _arbiterSlim      = null;
     _arbiterSlimIndex = -1;
 }