Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a8ae5f

Browse files
committed
Clean-up threading.Barrier example.
1 parent 5cee47f commit 3a8ae5f

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

Doc/whatsnew/3.2.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ Example of using barriers::
846846
summarize(ballots)
847847

848848
all_polls_closed = Barrier(len(sites))
849-
for site in sites(get_votes(site)):
849+
for site in sites:
850850
Thread(target=get_votes, args=(site,)).start()
851851

852852
In this example, the barrier enforces a rule that votes cannot be counted at any
@@ -856,10 +856,13 @@ and continue to do work (summarizing ballots) after the barrier point is
856856
crossed.
857857

858858
See `Barrier Synchronization Patterns
859-
<http://parlab.eecs.berkeley.edu/wiki/_media/patterns/paraplop_g1_3.pdf>`_
860-
for more examples of how barriers can be used in parallel computing.
859+
<http://parlab.eecs.berkeley.edu/wiki/_media/patterns/paraplop_g1_3.pdf>`_ for
860+
more examples of how barriers can be used in parallel computing. Also, there is
861+
a simple but thorough explanation of barriers in `The Little Book of Semaphores
862+
<http://greenteapress.com/semaphores/downey08semaphores.pdf>`_, *section 3.6*.
861863

862-
(Contributed by Kristján Valur Jónsson in :issue:`8777`.)
864+
(Contributed by Kristján Valur Jónsson with an API review by Jeffrey Yasskin in
865+
:issue:`8777`.)
863866

864867
datetime
865868
--------

0 commit comments

Comments
 (0)