File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ managed way.
165165
166166With this in mind, the :mod: `!concurrent.interpreters ` module provides
167167a :class: `queue.Queue ` implementation, available through
168- :func: `create_queue `.
168+ :func: `create_queue `.
169169
170170.. _interp-object-sharing :
171171
@@ -228,6 +228,23 @@ This module defines the following functions:
228228
229229 Initialize a new cross-interpreter queue and return a :class: `Queue `
230230 object for it.
231+ Queues created using the function ``create_queue `` can be used to
232+ safely communicate between multiple interpreters. Since the interpreters
233+ are isolated and do not share variables or data directly,
234+ a queue provides a mechanism to exchange data between them.
235+
236+ Example::
237+
238+ from concurrent.interpreters import create_queue
239+
240+ q = create_queue()
241+
242+ # In one interpreter
243+ q.put("Hello")
244+
245+ # In other interpreter
246+ message = q.get()
247+ print(message)
231248
232249
233250Interpreter objects
You can’t perform that action at this time.
0 commit comments