Skip to content
This repository was archived by the owner on Nov 23, 2017. It is now read-only.

Commit 7b2d8ab

Browse files
committed
BaseEventLoop: rename _owner to _thread_id
1 parent 0105a8f commit 7b2d8ab

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

asyncio/base_events.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def __init__(self):
188188
self._internal_fds = 0
189189
# Identifier of the thread running the event loop, or None if the
190190
# event loop is not running
191-
self._owner = None
191+
self._thread_id = None
192192
self._clock_resolution = time.get_clock_info('monotonic').resolution
193193
self._exception_handler = None
194194
self._debug = (not sys.flags.ignore_environment
@@ -269,15 +269,15 @@ def run_forever(self):
269269
self._check_closed()
270270
if self.is_running():
271271
raise RuntimeError('Event loop is running.')
272-
self._owner = threading.get_ident()
272+
self._thread_id = threading.get_ident()
273273
try:
274274
while True:
275275
try:
276276
self._run_once()
277277
except _StopError:
278278
break
279279
finally:
280-
self._owner = None
280+
self._thread_id = None
281281

282282
def run_until_complete(self, future):
283283
"""Run until the Future is done.
@@ -362,7 +362,7 @@ def __del__(self):
362362

363363
def is_running(self):
364364
"""Returns True if the event loop is running."""
365-
return (self._owner is not None)
365+
return (self._thread_id is not None)
366366

367367
def time(self):
368368
"""Return the time according to the event loop's clock.
@@ -449,10 +449,10 @@ def _check_thread(self):
449449
Should only be called when (self._debug == True). The caller is
450450
responsible for checking this condition for performance reasons.
451451
"""
452-
if self._owner is None:
452+
if self._thread_id is None:
453453
return
454454
thread_id = threading.get_ident()
455-
if thread_id != self._owner:
455+
if thread_id != self._thread_id:
456456
raise RuntimeError(
457457
"Non-thread-safe operation invoked on an event loop other "
458458
"than the current one")

0 commit comments

Comments
 (0)