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); } }
public virtual bool IsMajority(int n) { return(n >= (1 + Proposers.Union(Deciders).Count() / 2)); }