In this example, the barrier enforces a rule that vote
s cannot be counted at any poll
ing site until all poll
s are closed. Notice how a solution with a barrier is similar to one with :meth:`threading.Thread.join`, but the threads stay alive and continue to do work (summarizing ballot
s) after the barrier point is crossed.
In this example, the barrier enforces a more robust rule. If some election sites do not finish before midnight, the barrier times-out and the ballots are sealed and deposited in a queue for later handling.