queue — Thread-safe FIFO Implementation — PyMOTW 3
The queue module provides a first-in, first-out (FIFO) data structure suitable for multi-threaded programming. It can be used to pass messages or other data between producer and consumer threads safely. Locking is handled for the caller, so many threads can work with the same Queue instance safely and easily. The size of a Queue (the number of elements it contains) may be restricted to throttle memory usage or processing.
This post is part of the Python Module of the Week series for Python 3. See PyMOTW.com for more articles from the series.