Skip to content

Commit

Permalink
threading.Thread has an is_alive, but not an isAlive.
Browse files Browse the repository at this point in the history
Fixing to use correct one.
  • Loading branch information
joshua-cogliati-inl committed Jan 12, 2023
1 parent 06891c3 commit 849f70f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ravenframework/Runners/SharedMemoryRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def kill(self):
"""
if self.thread is not None:
self.raiseADebug('Terminating job thread "{}" and RAVEN identifier "{}"'.format(self.thread.ident, self.identifier))
while self.thread is not None and self.thread.isAlive():
while self.thread is not None and self.thread.is_alive():
time.sleep(0.1)
try:
self.thread.raiseException(RuntimeError)
Expand Down Expand Up @@ -174,7 +174,7 @@ def raiseException(self, exceptionType):
t = InterruptibleThread( ... )
...
t.raiseException( SomeException )
while t.isAlive():
while t.is_alive():
time.sleep( 0.1 )
t.raiseException( SomeException )
If the exception is to be caught by the thread, you need a way to check that your thread has caught it.
Expand All @@ -183,7 +183,7 @@ def raiseException(self, exceptionType):
@ In, exceptionType, Exception, the type of exception to raise in this thread
@ Out, None
"""
if self.isAlive():
if self.is_alive():
## Assuming Python 2.6+, we can remove the need for the _get_my_tid as
## specifed in the Stack Overflow answer
_asyncRaise( self.ident, exceptionType )

0 comments on commit 849f70f

Please sign in to comment.