Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a87501fd
Commit
a87501fd
authored
Feb 05, 2015
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asyncio: BaseEventLoop: rename _owner to _thread_id
parent
05784a70
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
Lib/asyncio/base_events.py
Lib/asyncio/base_events.py
+6
-6
No files found.
Lib/asyncio/base_events.py
View file @
a87501fd
...
...
@@ -188,7 +188,7 @@ class BaseEventLoop(events.AbstractEventLoop):
self
.
_internal_fds
=
0
# Identifier of the thread running the event loop, or None if the
# event loop is not running
self
.
_
owner
=
None
self
.
_
thread_id
=
None
self
.
_clock_resolution
=
time
.
get_clock_info
(
'monotonic'
).
resolution
self
.
_exception_handler
=
None
self
.
_debug
=
(
not
sys
.
flags
.
ignore_environment
...
...
@@ -269,7 +269,7 @@ class BaseEventLoop(events.AbstractEventLoop):
self
.
_check_closed
()
if
self
.
is_running
():
raise
RuntimeError
(
'Event loop is running.'
)
self
.
_
owner
=
threading
.
get_ident
()
self
.
_
thread_id
=
threading
.
get_ident
()
try
:
while
True
:
try
:
...
...
@@ -277,7 +277,7 @@ class BaseEventLoop(events.AbstractEventLoop):
except
_StopError
:
break
finally
:
self
.
_
owner
=
None
self
.
_
thread_id
=
None
def
run_until_complete
(
self
,
future
):
"""Run until the Future is done.
...
...
@@ -362,7 +362,7 @@ class BaseEventLoop(events.AbstractEventLoop):
def
is_running
(
self
):
"""Returns True if the event loop is running."""
return
(
self
.
_
owner
is
not
None
)
return
(
self
.
_
thread_id
is
not
None
)
def
time
(
self
):
"""Return the time according to the event loop's clock.
...
...
@@ -449,10 +449,10 @@ class BaseEventLoop(events.AbstractEventLoop):
Should only be called when (self._debug == True). The caller is
responsible for checking this condition for performance reasons.
"""
if
self
.
_
owner
is
None
:
if
self
.
_
thread_id
is
None
:
return
thread_id
=
threading
.
get_ident
()
if
thread_id
!=
self
.
_
owner
:
if
thread_id
!=
self
.
_
thread_id
:
raise
RuntimeError
(
"Non-thread-safe operation invoked on an event loop other "
"than the current one"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment