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

Side by Side Diff: Lib/threading.py

Issue 22043: Use a monotonic clock to compute timeouts
Patch Set: Created 3 years 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:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_selectors.py ('k') | Lib/trace.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Thread module emulating a subset of Java's threading model.""" 1 """Thread module emulating a subset of Java's threading model."""
2 2
3 import sys as _sys 3 import sys as _sys
4 import _thread 4 import _thread
5 5
6 try: 6 from time import monotonic as _time
7 from time import monotonic as _time
8 except ImportError:
9 from time import time as _time
10 from traceback import format_exc as _format_exc 7 from traceback import format_exc as _format_exc
11 from _weakrefset import WeakSet 8 from _weakrefset import WeakSet
12 from itertools import islice as _islice 9 from itertools import islice as _islice
13 try: 10 try:
14 from _collections import deque as _deque 11 from _collections import deque as _deque
15 except ImportError: 12 except ImportError:
16 from collections import deque as _deque 13 from collections import deque as _deque
17 14
18 # Note regarding PEP 8 compliant names 15 # Note regarding PEP 8 compliant names
19 # This threading model was originally inspired by Java, and inherited 16 # This threading model was originally inspired by Java, and inherited
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 new_active[ident] = thread 1353 new_active[ident] = thread
1357 else: 1354 else:
1358 # All the others are already stopped. 1355 # All the others are already stopped.
1359 thread._reset_internal_locks(False) 1356 thread._reset_internal_locks(False)
1360 thread._stop() 1357 thread._stop()
1361 1358
1362 _limbo.clear() 1359 _limbo.clear()
1363 _active.clear() 1360 _active.clear()
1364 _active.update(new_active) 1361 _active.update(new_active)
1365 assert len(_active) == 1 1362 assert len(_active) == 1
OLDNEW
« no previous file with comments | « Lib/test/test_selectors.py ('k') | Lib/trace.py » ('j') | no next file with comments »

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