Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1055)

Delta Between Two Patch Sets: Lib/queue.py

Issue 22043: Use a monotonic clock to compute timeouts
Left Patch Set: Created 3 years, 3 months ago
Right Patch Set: Created 3 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « Include/pytime.h ('k') | Lib/sched.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 '''A multi-producer, multi-consumer queue.''' 1 '''A multi-producer, multi-consumer queue.'''
2 2
3 try: 3 try:
4 import threading 4 import threading
5 except ImportError: 5 except ImportError:
6 import dummy_threading as threading 6 import dummy_threading as threading
7 from collections import deque 7 from collections import deque
8 from heapq import heappush, heappop 8 from heapq import heappush, heappop
9 try: 9 from time import monotonic as time
10 from time import monotonic as time
11 except ImportError:
12 from time import time
13 10
14 __all__ = ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue'] 11 __all__ = ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue']
15 12
16 class Empty(Exception): 13 class Empty(Exception):
17 'Exception raised by Queue.get(block=0)/get_nowait().' 14 'Exception raised by Queue.get(block=0)/get_nowait().'
18 pass 15 pass
19 16
20 class Full(Exception): 17 class Full(Exception):
21 'Exception raised by Queue.put(block=0)/put_nowait().' 18 'Exception raised by Queue.put(block=0)/put_nowait().'
22 pass 19 pass
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 self.queue = [] 237 self.queue = []
241 238
242 def _qsize(self): 239 def _qsize(self):
243 return len(self.queue) 240 return len(self.queue)
244 241
245 def _put(self, item): 242 def _put(self, item):
246 self.queue.append(item) 243 self.queue.append(item)
247 244
248 def _get(self): 245 def _get(self):
249 return self.queue.pop() 246 return self.queue.pop()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7