If you run the preceding program on your system, you should, hopefully, see an output similar to the following.
You'll see our four threads printing out that they are working on something, and then, one by one, they randomly start waiting on our barrier object. Once the 4th thread starts waiting, the program almost instantly finishes, as all four threads do their final print statements now that the barrier has been lifted.
$ python3.6 08_barriers.py
Thread <myThread(Thread-1, started 123145344643072)> working on
something
Thread <myThread(Thread-2, started 123145349898240)> working on
something
Thread <myThread(Thread-3, started 123145355153408)> working on
something
Thread <myThread(Thread-4, started 123145360408576)> working on
something
Thread <myThread(Thread-1, started 123145344643072)> is joining 0
waiting on Barrier
Thread <myThread(Thread-3, started 123145355153408)> is joining 1
waiting on Barrier
Thread <myThread(Thread-2, started 123145349898240)> is joining 2
waiting on Barrier
Thread <myThread(Thread-4, started 123145360408576)> is joining 3
waiting on Barrier
Barrier has been lifted, continuing with work
Barrier has been lifted, continuing with work
Barrier has been lifted, continuing with work
Barrier has been lifted, continuing with work