Commit 0841f00b authored by Denis Bilenko's avatar Denis Bilenko

replace get_hub().switch() with self.parent.switch - should be faster as it...

replace get_hub().switch() with self.parent.switch - should be faster as it avoids accessing threadlocal

--HG--
extra : transplant_source : %95%EA%B0%28b%28%EB%3E%EC%B5%DC%26%AD%86%CA%89/%C6%B6%85
parent 8dc1b538
...@@ -317,7 +317,7 @@ class Greenlet(greenlet): ...@@ -317,7 +317,7 @@ class Greenlet(greenlet):
try: try:
t = Timeout.start_new(timeout) t = Timeout.start_new(timeout)
try: try:
result = get_hub().switch() result = self.parent.switch()
assert result is self, 'Invalid switch into Greenlet.get(): %r' % (result, ) assert result is self, 'Invalid switch into Greenlet.get(): %r' % (result, )
finally: finally:
t.cancel() t.cancel()
...@@ -349,7 +349,7 @@ class Greenlet(greenlet): ...@@ -349,7 +349,7 @@ class Greenlet(greenlet):
try: try:
t = Timeout.start_new(timeout) t = Timeout.start_new(timeout)
try: try:
result = get_hub().switch() result = self.parent.switch()
assert result is self, 'Invalid switch into Greenlet.join(): %r' % (result, ) assert result is self, 'Invalid switch into Greenlet.join(): %r' % (result, )
finally: finally:
t.cancel() t.cancel()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment