Skip to content
This repository was archived by the owner on Apr 14, 2024. It is now read-only.

Commit 7298742

Browse files
committed
Added schedule_termination to TerminatableThread and updated the thread-terminator with that new technique
1 parent 5992bb6 commit 7298742

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

thread.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def do_terminate_threads(whitelist=list()):
2121
continue
2222
if whitelist and t not in whitelist:
2323
continue
24+
t.schedule_termination()
2425
t.stop_and_join()
2526
# END for each thread
2627

@@ -76,7 +77,11 @@ def start(self):
7677

7778
#} END subclass interface
7879

79-
#{ Interface
80+
#{ Interface
81+
def schedule_termination(self):
82+
"""Schedule this thread to be terminated as soon as possible.
83+
:note: this method does not block."""
84+
self._terminate = True
8085

8186
def stop_and_join(self):
8287
"""Ask the thread to stop its operation and wait for it to terminate

0 commit comments

Comments
 (0)