Skip to content

Commit c1acf93

Browse files
Add docs for Queue and create_queue().
1 parent e146e84 commit c1acf93

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

Doc/library/concurrent.interpreters.rst

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ This module defines the following functions:
195195
Initialize a new (idle) Python interpreter
196196
and return a :class:`Interpreter` object for it.
197197

198+
.. function:: create_queue()
199+
200+
Initialize a new cross-interpreter queue and return a :class:`Queue`
201+
object for it.
202+
198203

199204
Interpreter objects
200205
^^^^^^^^^^^^^^^^^^^
@@ -277,7 +282,36 @@ Exceptions
277282
an object cannot be sent to another interpreter.
278283

279284

280-
.. XXX Add functions for communicating between interpreters.
285+
Communicating Between Interpreters
286+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
287+
288+
.. class:: Queue(id)
289+
290+
A wrapper around a low-level, cross-interpreter queue, which
291+
implements the :class:`queue.Queue` interface. The underlying queue
292+
can only be created through :func:`create_queue`.
293+
294+
Cross-interpreter queues support all the same objects as
295+
:meth:`Interpreter.prepare_main`.
296+
297+
.. attribute:: id
298+
299+
(read-only)
300+
301+
The queue's ID.
302+
303+
304+
.. exception:: QueueEmptyError
305+
306+
This is exception, a subclass of :exc:`queue.Empty`, is raised from
307+
:meth:`!Queue.get` and :meth:`!Queue.get_nowait` when the queue
308+
is empty.
309+
310+
.. exception:: QueueFullError
311+
312+
This is exception, a subclass of :exc:`queue.Full`, is raised from
313+
:meth:`!Queue.put` and :meth:`!Queue.put_nowait` when the queue
314+
is full.
281315

282316

283317
Basic usage

0 commit comments

Comments
 (0)