@@ -188,7 +188,7 @@ def __init__(self):
188
188
self ._internal_fds = 0
189
189
# Identifier of the thread running the event loop, or None if the
190
190
# event loop is not running
191
- self ._owner = None
191
+ self ._thread_id = None
192
192
self ._clock_resolution = time .get_clock_info ('monotonic' ).resolution
193
193
self ._exception_handler = None
194
194
self ._debug = (not sys .flags .ignore_environment
@@ -269,15 +269,15 @@ def run_forever(self):
269
269
self ._check_closed ()
270
270
if self .is_running ():
271
271
raise RuntimeError ('Event loop is running.' )
272
- self ._owner = threading .get_ident ()
272
+ self ._thread_id = threading .get_ident ()
273
273
try :
274
274
while True :
275
275
try :
276
276
self ._run_once ()
277
277
except _StopError :
278
278
break
279
279
finally :
280
- self ._owner = None
280
+ self ._thread_id = None
281
281
282
282
def run_until_complete (self , future ):
283
283
"""Run until the Future is done.
@@ -362,7 +362,7 @@ def __del__(self):
362
362
363
363
def is_running (self ):
364
364
"""Returns True if the event loop is running."""
365
- return (self ._owner is not None )
365
+ return (self ._thread_id is not None )
366
366
367
367
def time (self ):
368
368
"""Return the time according to the event loop's clock.
@@ -449,10 +449,10 @@ def _check_thread(self):
449
449
Should only be called when (self._debug == True). The caller is
450
450
responsible for checking this condition for performance reasons.
451
451
"""
452
- if self ._owner is None :
452
+ if self ._thread_id is None :
453
453
return
454
454
thread_id = threading .get_ident ()
455
- if thread_id != self ._owner :
455
+ if thread_id != self ._thread_id :
456
456
raise RuntimeError (
457
457
"Non-thread-safe operation invoked on an event loop other "
458
458
"than the current one" )
0 commit comments