From: Raymond Hettinger Date: Tue, 11 Jan 2011 20:51:45 +0000 (+0000) Subject: Clean-up threading.Barrier example. X-Git-Tag: v3.2rc1~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a8ae5f9f42cae192d8cd3f2b4817340a5071220;p=thirdparty%2FPython%2Fcpython.git Clean-up threading.Barrier example. --- diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index e49db1ed1d4a..53de2c975058 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -846,7 +846,7 @@ Example of using barriers:: summarize(ballots) all_polls_closed = Barrier(len(sites)) - for site in sites(get_votes(site)): + for site in sites: Thread(target=get_votes, args=(site,)).start() 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 crossed. See `Barrier Synchronization Patterns -`_ -for more examples of how barriers can be used in parallel computing. +`_ for +more examples of how barriers can be used in parallel computing. Also, there is +a simple but thorough explanation of barriers in `The Little Book of Semaphores +`_, *section 3.6*. -(Contributed by Kristján Valur Jónsson in :issue:`8777`.) +(Contributed by Kristján Valur Jónsson with an API review by Jeffrey Yasskin in +:issue:`8777`.) datetime --------