PyDocs

Nav

Concurrent Execution

Queue.put

  • Queue.put(obj, block=True, timeout=None)
Add the object to the queue.

If "block" is true, this blocks while the queue is full.

For most objects, the object received through Queue.get() will
be a new one, equivalent to the original and not sharing any
actual underlying data.  The notable exceptions include
cross-interpreter types (like Queue) and memoryview, where the
underlying data is actually shared.  Furthermore, some types
can be sent through a queue more efficiently than others.  This
group includes various immutable types like int, str, bytes, and
tuple (if the items are likewise efficiently shareable).
See interpreters.is_shareable().

"unbounditems" controls the behavior of Queue.get() for the given
object if the current interpreter (calling put()) is later
destroyed.

If "unbounditems" is None (the default) then it uses the
queue's default, set with create_queue(),
which is usually UNBOUND.

If "unbounditems" is UNBOUND_ERROR then get() will raise an
ItemInterpreterDestroyed exception if the original interpreter
has been destroyed.  This does not otherwise affect the queue;
the next call to put() will work like normal, returning the next
item in the queue.

If "unbounditems" is UNBOUND_REMOVE then the item will be removed
from the queue as soon as the original interpreter is destroyed.
Be aware that this will introduce an imbalance between put()
and get() calls.

If "unbounditems" is UNBOUND then it is returned by get() in place
of the unbound item.
0 Examples
No examples for concurrent.interpreters/Queue.put.
See Also
No see-alsos for concurrent.interpreters/Queue.put
0 Notes
No notes for Queue.put