inter thread/process synchronisation all parties reach the barrier but before allowing those parties to continue the post-phase action (the callbackexecutes in single thread (or processonce it is completed then all the parties are unblocked and may continue this is illustrated in the following diagram threads and are all involved in the barrier when thread reaches the barrier it must wait until it is released by the barrier similarly when reaches the barrier it must wait when finally reaches the barrier the callback is invoked once the callback has completed the barrier releases all three threads which are then able to continue an example of using barrier object is given below note that the function being invoked in each thread must also cooperate in using the barrier as the code will run up to the barrier wait(method and then wait until all other threads have also reached this point before being allowed to continue the barrier is class that can be used to create barrier object when the barrier class is instantiatedit can be provided with three parameterswhere parties the number of individual parties that will participate in the barrier action is callable object (such as functionwhichwhen suppliedwill be called after all the parties have entered the barrier and just prior to releasing them all timeout if 'timeoutis providedit is used as the default for all subsequent wait(calls on the barrier thusin the following code barrier( action=callbackindicates that there will be three parties involved in the barrier and that the callback function will be invoked when all three reach the barrier (however the timeout is left as the default value nonethe barrier object is created outside of the threads (or processesbut must be made available to the function being executed by the thread (or processthe easiest way to handle this is to pass the barrier into the function as one of the