Skip to content

Commit 53fada2

Browse files
+ is_alive method
1 parent f3cf861 commit 53fada2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/thread/thread.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,19 @@ def result(self) -> Data_Out:
166166
else:
167167
raise exceptions.ThreadStillRunningError()
168168

169+
170+
def is_alive(self) -> bool:
171+
"""
172+
See if thread is still alive
173+
174+
Raises
175+
------
176+
ThreadNotInitializedError: If the thread is not intialized
177+
"""
178+
if not self._thread:
179+
raise exceptions.ThreadNotInitializedError()
180+
return self._thread.is_alive()
181+
169182

170183
def add_hook(self, hook: Callable[[Data_Out], Any | None]) -> None:
171184
"""

0 commit comments

Comments
 (0)