Create a barrier object for parties number of threads. An action, when provided, is a callable to be called by one of the threads when they are released. timeout is the default timeout value if none is specified for the wait() method.
class threading.Barrier(parties, action=None, timeout=None)
i = barrier.wait()
if i == 0:
Only one thread needs to print this
print("passed the barrier")