Lines Matching full:queue

1 '''A multi-producer, multi-consumer queue.'''
12 __all__ = ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue', 'SimpleQueue']
19 'Exception raised by Queue.get(block=0)/get_nowait().'
23 'Exception raised by Queue.put(block=0)/put_nowait().'
27 class Queue: class
28 '''Create a queue object with a given maximum size.
30 If maxsize is <= 0, the queue size is infinite.
37 # mutex must be held whenever the queue is mutating. All methods
43 # Notify not_empty whenever an item is added to the queue; a
47 # Notify not_full whenever an item is removed from the queue;
59 Used by Queue consumer threads. For each get() used to fetch a task,
60 a subsequent call to task_done() tells the queue that the processing
65 for every item that had been put() into the queue).
68 placed in the queue.
79 '''Blocks until all items in the Queue have been gotten and processed.
82 queue. The count goes down whenever a consumer thread calls task_done()
92 '''Return the approximate size of the queue (not reliable!).'''
97 '''Return True if the queue is empty, False otherwise (not reliable!).
101 condition where a queue can grow before the result of empty() or
111 '''Return True if the queue is full, False otherwise (not reliable!).
115 condition where a queue can shrink before the result of full() or
122 '''Put an item into the queue.
128 Otherwise ('block' is false), put an item on the queue if a free slot
154 '''Remove and return an item from the queue.
185 '''Put an item into the queue without blocking.
193 '''Remove and return an item from the queue without blocking.
200 # Override these methods to implement other queue organizations
201 # (e.g. stack or priority queue).
204 # Initialize the queue representation
206 self.queue = deque()
209 return len(self.queue)
211 # Put a new item in the queue
213 self.queue.append(item)
215 # Get an item from the queue
217 return self.queue.popleft()
220 class PriorityQueue(Queue):
221 '''Variant of Queue that retrieves open entries in priority order (lowest first).
227 self.queue = []
230 return len(self.queue)
233 heappush(self.queue, item)
236 return heappop(self.queue)
239 class LifoQueue(Queue):
240 '''Variant of Queue that retrieves most recently added entries first.'''
243 self.queue = []
246 return len(self.queue)
249 self.queue.append(item)
252 return self.queue.pop()
256 '''Simple, unbounded FIFO queue.
270 '''Put the item on the queue.
273 never blocks. They are provided for compatibility with the Queue class.
279 '''Remove and return an item from the queue.
296 '''Put an item into the queue without blocking.
299 for compatibility with the Queue class.
304 '''Remove and return an item from the queue without blocking.
312 '''Return True if the queue is empty, False otherwise (not reliable!).'''
316 '''Return the approximate size of the queue (not reliable!).'''