8000 Update documentation about add of Barrier object · python/cpython@576cd53 · GitHub
[go: up one dir, main page]

Skip to content

Commit 576cd53

Browse files
committed
Update documentation about add of Barrier object
Add Barrier object as a clone of threading.Barrier
1 parent 9b60d07 commit 576cd53

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Doc/library/asyncio-api-index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ Threading-like synchronization primitives that can be used in Tasks.
186186
* - :class:`BoundedSemaphore`
187187
- A bounded semaphore.
188188

189+
* - :class:`Barrier`
190+
- A barrier object.
191+
189192

190193
.. rubric:: Examples
191194

Doc/library/asyncio-sync.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ asyncio has the following basic synchronization primitives:
2828
* :class:`Condition`
2929
* :class:`Semaphore`
3030
* :class:`BoundedSemaphore`
31+
* :class:`Barrier`
3132

3233

3334
---------
@@ -325,6 +326,22 @@ BoundedSemaphore
325326
a :exc:`ValueError` in :meth:`~Semaphore.release` if it
326327
increases the internal counter above the initial *value*.
327328

329+
330+
Barrier
331+
=======
332+
333+
.. class:: Barrier(parties, action=None)
334+
335+
A barrier object. Not thread-safe.
336+
337+
Create a barrier object for *parties* number of tasks. An *action*, when
338+
provided, is a callable to be called by one of the tasks when they are
339+
released.
340+
341+
A barrier object: a clone of :class:`threading.Barrier`.
342+
343+
.. versionadded:: 3.10
344+
328345
---------
329346

330347

0 commit comments

Comments
 (0)
0