Skip to content

Commit a288a3d

Browse files
breaking: Follow threading.Thread.join() function signature
1 parent 60face1 commit a288a3d

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/thread/thread.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,14 @@ def add_hook(self, hook: HookFunction[_Target_T]) -> None:
230230
"""
231231
self.hooks.append(hook)
232232

233-
def join(self, timeout: Optional[float] = None) -> bool:
233+
def join(self, timeout: Optional[float] = None) -> None:
234234
"""
235235
Halts the current thread execution until a thread completes or exceeds the timeout
236236
237237
Parameters
238238
----------
239239
:param timeout: The maximum time allowed to halt the thread
240240
241-
Returns
242-
-------
243-
:returns bool: True if the thread is no-longer alive
244-
245241
Raises
246242
------
247243
ThreadNotInitializedError: If the thread is not initialized
@@ -255,7 +251,6 @@ def join(self, timeout: Optional[float] = None) -> bool:
255251

256252
super().join(timeout)
257253
self._handle_exceptions()
258-
return not self.is_alive()
259254

260255
def get_return_value(self) -> _Target_T:
261256
"""
@@ -598,14 +593,10 @@ def get_return_values(self) -> List[_Dataset_T]:
598593
results += entry.thread.result
599594
return results
600595

601-
def join(self) -> bool:
596+
def join(self) -> None:
602597
"""
603598
Halts the current thread execution until a thread completes or exceeds the timeout
604599
605-
Returns
606-
-------
607-
:returns bool: True if the thread is no-longer alive
608-
609600
Raises
610601
------
611602
ThreadNotInitializedError: If the thread is not initialized
@@ -619,7 +610,6 @@ def join(self) -> bool:
619610

620611
for entry in self._threads:
621612
entry.thread.join()
622-
return True
623613

624614
def kill(self) -> None:
625615
"""

tests/test_thread.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def test_threadCreation():
2121
target=_dummy_target_raiseToPower, args=[4], kwargs={'power': 2}, daemon=True
2222
)
2323
new.start()
24-
assert new.join()
24+
new.join()
25+
assert not new.is_alive()
2526
assert new.result == 16
2627

2728

0 commit comments

Comments
 (0)