示例#1
0
        public void Execute(int millisecondsTimeout)
        {
            var all = Proposers.Union(Deciders);

            foreach (var p in all)
            {
                p.Bind(this);
            }

            ThreadManager.ForEach(all, p => p.Execute(this));

            ThreadManager.Join(millisecondsTimeout);

            if (ConsensusReached(all))
            {
                Consensus = true;
                Value     = GetAgreedValue(all);
            }
        }
示例#2
0
 public virtual bool IsMajority(int n)
 {
     return(n >= (1 + Proposers.Union(Deciders).Count() / 2));
 }