PyDocs

Nav

Concurrent Execution

Queue

multiprocessing

class (source) not Androidnot iOSnot WASI
  • Queue([maxsize])
Returns a queue object
Members of Queue

c

cancel_join_thread
Prevent join_thread() from blocking.
close
Close the queue: release internal resources.

e

empty
Return True if the queue is empty, False otherwise.

f

full
Return True if the queue is full, False otherwise.

g

get
Remove and return an item from the queue.
get_nowait
Equivalent to get(False).

j

join_thread
Join the background thread.

p

put
Put obj into the queue.
put_nowait
Equivalent to put(obj, False).

q

qsize
Return the approximate size of the queue.
1 Example
>>> from multiprocessing import Process, Queue
>>> from multiprocessing.managers import BaseManager
>>> class Worker(Process):
...     def __init__(self, q):
...         self.q = q
...         super().__init__()
...     def run(self):
...         self.q.put('local hello')
...
>>> queue = Queue()
>>> w = Worker(queue)
>>> w.start()
>>> class QueueManager(BaseManager): pass
...
>>> QueueManager.register('get_queue', callable=lambda: queue)
>>> m = QueueManager(address=('', 50000), authkey=b'abracadabra')
>>> s = m.get_server()
>>> s.serve_forever()
from the Python docs
See Also
No see-alsos for multiprocessing/Queue
0 Notes
No notes for Queue