@@ -1441,22 +1441,22 @@ Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`,
14411441Iterator synchronization
14421442------------------------
14431443
1444- By default, Python iterators do not support concurrent use . Most iterators make
1444+ By default, Python iterators do not support concurrent access . Most iterators make
14451445no guarantees when accessed simultaneously from multiple threads. Generator
14461446iterators, for example, raise :exc: `ValueError ` if one of their iterator methods
14471447is called while the generator is already executing. The tools in this section
14481448allow reliable concurrency support to be added to ordinary iterators and
14491449iterator-producing callables.
14501450
1451- Use :class: `serialize ` when multiple threads should share a single iterator and
1451+ The :class: `serialize ` wrapper lets multiple threads share a single iterator and
14521452take turns consuming from it. While one thread is running ``__next__() ``, the
14531453others block until the iterator becomes available. Each value produced by the
14541454underlying iterator is delivered to exactly one caller.
14551455
1456- Use :func: `concurrent_tee ` when multiple threads should each receive the full
1456+ The :func: `concurrent_tee ` function lets multiple threads each receive the full
14571457stream of values from one underlying iterator. It creates independent iterators
1458- that all draw from the same source. Values are buffered until every derived
1459- iterator has received them .
1458+ that all draw from the same source. Values are buffered until consumed by all
1459+ of the derived iterators .
14601460
14611461.. class :: serialize(iterable)
14621462
@@ -1466,8 +1466,8 @@ iterator has received them.
14661466 This makes it possible to share a single iterator, including a generator
14671467 iterator, between multiple threads. Calls are handled one at a time in
14681468 arrival order determined by lock acquisition. No values are duplicated or
1469- skipped by the wrapper itself; each item produced by the underlying iterator
1470- is returned to exactly one caller.
1469+ skipped by the wrapper itself. Each item produced by the underlying iterator
1470+ is given to exactly one caller.
14711471
14721472 This wrapper does not copy or buffer values. Threads that call
14731473 :func: `next ` while another thread is already advancing the iterator will
@@ -1501,8 +1501,8 @@ iterator has received them.
15011501 Wrap an iterator-producing callable so that each iterator it returns is
15021502 automatically passed through :class: `serialize `.
15031503
1504- This is especially useful as a decorator for generator functions that may be
1505- consumed from multiple threads.
1504+ This is especially useful as a :term: ` decorator ` for generator functions,
1505+ allowing their generator-iterators to be consumed from multiple threads.
15061506
15071507 Example::
15081508
@@ -1541,8 +1541,7 @@ iterator has received them.
15411541 the same order.
15421542
15431543 Internally, values are buffered until every derived iterator has consumed
1544- them. As a result, if one consumer falls far behind the others, the buffer
1545- may grow without bound.
1544+ them.
15461545
15471546 The returned iterators share the same underlying synchronization lock. Each
15481547 individual derived iterator is intended to be consumed by one thread at a
@@ -1570,4 +1569,4 @@ iterator has received them.
15701569 t1.join()
15711570 t2.join()
15721571
1573- Here , both threads see the full sequence ``0 `` through ``4 ``.
1572+ In this example , both consumer threads see the full sequence ``0 `` through ``4 ``.
0 commit comments