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

Commit

Permalink
Added schedule_termination to TerminatableThread and updated the thre…
Browse files Browse the repository at this point in the history
…ad-terminator with that new technique
  • Loading branch information
Byron committed Nov 12, 2010
1 parent 5992bb6 commit 7298742
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def do_terminate_threads(whitelist=list()):
continue
if whitelist and t not in whitelist:
continue
t.schedule_termination()
t.stop_and_join()
# END for each thread

Expand Down Expand Up @@ -76,7 +77,11 @@ def start(self):

#} END subclass interface

#{ Interface
#{ Interface
def schedule_termination(self):
"""Schedule this thread to be terminated as soon as possible.
:note: this method does not block."""
self._terminate = True

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

0 comments on commit 7298742

Please sign in to comment.