-
Notifications
You must be signed in to change notification settings - Fork 553
Handle failure during thread creation #2471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
58568fd
a24a1c4
60b5e32
7b03304
1392666
25b87a6
807f09f
30bf13a
842950f
3dcec2a
d4302a4
02efaca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -918,7 +918,13 @@ def ensure_running(self): | |
# can keep the application running after other threads | ||
# have exited | ||
self.thread = threading.Thread(name=self.name, target=self.run, daemon=True) | ||
self.thread.start() | ||
try: | ||
self.thread.start() | ||
except RuntimeError: | ||
# Unfortunately at this point the interpreter is in a state that no | ||
# longer allows us to spawn a thread and we have to bail. | ||
self.running = False | ||
return | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find it slightly confusing here that the method is called If we make this change to indicate when the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @szokeasaurusrex Added docstrings to the three I considered making the function return a bool, but in all three cases it already communicates success/failure by setting the Regarding the other points:
|
||
|
||
def run(self): | ||
# type: () -> None | ||
|
Uh oh!
There was an error while loading. Please reload this page.