/// <summary> Set the function to call at the point at which all threads reach the /// rendezvous. This function is run exactly once, by the thread /// that trips the barrier. The function is not run if the barrier is /// broken. /// </summary> /// <param name="function">the function to run. If null, no function is run. /// </param> /// <returns> the previous function /// /// </returns> public virtual IRendezvousFunction SetRendezvousFunction(IRendezvousFunction function) { lock (this) { IRendezvousFunction old = rendezvousFunction_; rendezvousFunction_ = function; return(old); } }
/// <summary> Create a Barrier for the indicated number of parties. /// and the given function to run at each barrier point. /// </summary> /// <exception cref="ArgumentException">if parties less than or equal to zero. /// /// </exception> public Rendezvous(int parties, IRendezvousFunction function) { if (parties <= 0) { throw new System.ArgumentException(); } parties_ = parties; rendezvousFunction_ = function; entryGate_ = new WaiterPreferenceSemaphore(parties); slots_ = new System.Object[parties]; }
/// <summary> Set the function to call at the point at which all threads reach the /// rendezvous. This function is run exactly once, by the thread /// that trips the barrier. The function is not run if the barrier is /// broken. /// </summary> /// <param name="function">the function to run. If null, no function is run. /// </param> /// <returns> the previous function /// /// </returns> public virtual IRendezvousFunction SetRendezvousFunction(IRendezvousFunction function) { lock (this) { IRendezvousFunction old = rendezvousFunction_; rendezvousFunction_ = function; return old; } }
/// <summary> Create a Barrier for the indicated number of parties. /// and the given function to run at each barrier point. /// </summary> /// <exception cref="ArgumentException">if parties less than or equal to zero. /// /// </exception> public Rendezvous(int parties, IRendezvousFunction function) { if (parties <= 0) throw new System.ArgumentException(); parties_ = parties; rendezvousFunction_ = function; entryGate_ = new WaiterPreferenceSemaphore(parties); slots_ = new System.Object[parties]; }