Documentation of 'jsat.utils.concurrent.TreeBarrier' Java class
TreeBarrier
jsat.utils.concurrent

Class TreeBarrier



  • public class TreeBarrier
    extends java.lang.Object
    Tree Barrier is a barrier that requires only log(n) communication for barrier with n threads. To use this barrier, each thread must know its own unique ID that is sequential in [0, number of threads)

    NOTE: The Tree Barrier implementation is not safe for accessing multiple times in a row. If accessed while some threads are still attempting to exit, corruption and deadlock can occur. If needed, two TreeBarriers can be used by alternating back and forth.
    • Constructor Summary

      Constructors 
      Constructor and Description
      TreeBarrier(int parties)
      Creates a new Tree Barrier for synchronization
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void await(int ID)
      Waits for all threads to reach this barrier.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TreeBarrier

        public TreeBarrier(int parties)
        Creates a new Tree Barrier for synchronization
        Parameters:
        parties - the number of threads that must arrive to synchronize
    • Method Detail

      • await

        public void await(int ID)
                   throws java.lang.InterruptedException
        Waits for all threads to reach this barrier.
        Parameters:
        ID - the id of the thread attempting to reach the barrier.
        Throws:
        java.lang.InterruptedException - if one of the threads was interrupted while waiting on the barrier

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.