Queue Class
- 1 The empty() method of queue class The empty() method of queue class returns False if a queue instance holds one or more elements. It returns True otherwise. Since queue is synchronised and used in producer/consumer scenarios, the return value of the empty() method does not guarantee that a subsequent get() or put() will not block. 24 Nov 2019
- 2 full() method of Queue class in Python The full() method is the opposite of the empty() method. full() returns True, if the maximum capacity has reached for a queue. It returns False otherwise. The Python example uses a producer/consumer scenario and uses the full() method before calling get() and put(). 25 Nov 2019
- 3 get() method of Queue class The get() method of Queue class removes and returns an item from a Queue instance. If executed in blocking mode it waits till an item is available. A timeout as well can be specified. 26 Nov 2019
- 4 The Queue class from the queue module of Python Standard Library The Queue class offers a synchronized, non-reentrant queue and hence suitable for scenarios where multiple producers and multiple consumers take work packets or data from common queue instances. 23 Nov 2019
- 5 The put() method of Queue class in Python The method put() adds an element to an instance of Queue class while the instance has not reached its maximum capacity. If the queue is full the put() method blocks till an element is removed, typically by another thread with which the Queue instance is shared. 25 Nov 2019
- 6 qsize() method of the Queue class The qsize() method returns the approximate number of elements present the Queue instance. The example Python program adds elements into a Queue instance, through the parent thread and a child thread. Elements are removed using a child thread. The qsize() is called in the beginning and end of the get()/put() call combinations. 23 Nov 2019