This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run the given function in the interpreter (in a new thread).
Expand Down
Expand Up
@@ -159,7 +316,36 @@ Exceptions
an object cannot be sent to another interpreter.
.. XXX Add functions for communicating between interpreters.
Communicating Between Interpreters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. class:: Queue(id)
A wrapper around a low-level, cross-interpreter queue, which
implements the :class:`queue.Queue` interface. The underlying queue
can only be created through :func:`create_queue`.
Some objects are actually shared and some are copied efficiently,
but most are copied via :mod:`pickle`. See :ref:`interp-object-sharing`.
.. attribute:: id
(read-only)
The queue's ID.
.. exception:: QueueEmptyError
This exception, a subclass of :exc:`queue.Empty`, is raised from
:meth:`!Queue.get` and :meth:`!Queue.get_nowait` when the queue
is empty.
.. exception:: QueueFullError
This exception, a subclass of :exc:`queue.Full`, is raised from
:meth:`!Queue.put` and :meth:`!Queue.put_nowait` when the queue
is full.
Basic usage
Expand All
@@ -184,6 +370,12 @@ Creating an interpreter and running code in it::
print('spam!')
"""))
def run(arg):
return arg
res = interp.call(run, 'spam!')
print(res)
def run():
print('spam!')
Expand All
@@ -193,6 +385,3 @@ Creating an interpreter and running code in it::
t = interp.call_in_thread(run)
t.join()
.. XXX Explain about object "sharing".
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[3.14] gh-134939: Fill Out the concurrent.interpreters Docs (gh-135902) #136141
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
[3.14] gh-134939: Fill Out the concurrent.interpreters Docs (gh-135902) #136141
Filter by extension
Viewed files
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing