MCPcopy Create free account
hub / github.com/ActiveState/code / Thread

Class Thread

recipes/Python/496960_thread2__killable_threads/recipe-496960.py:15–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13 raise SystemError("PyThreadState_SetAsyncExc failed")
14
15class Thread(threading.Thread):
16 def raise_exc(self, excobj):
17 assert self.isAlive(), "thread must be started"
18 for tid, tobj in threading._active.items():
19 if tobj is self:
20 _async_raise(tid, excobj)
21 return
22
23 # the thread was alive when we entered the loop, but was not found
24 # in the dict, hence it must have been already terminated. should we raise
25 # an exception here? silently ignore?
26
27 def terminate(self):
28 # must raise the SystemExit type, instead of a SystemExit() instance
29 # due to a bug in PyThreadState_SetAsyncExc
30 self.raise_exc(SystemExit)

Callers 12

process_requestMethod · 0.50
recipe-577920.pyFile · 0.50
__init__Method · 0.50
mainFunction · 0.50
mainFunction · 0.50
threaded_file_readerFunction · 0.50
__call__Method · 0.50
async_funcFunction · 0.50
_outputMethod · 0.50
__init__Method · 0.50
mergeFunction · 0.50
sleep_sortFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected