, : , , . , subprocess.call
. , , , - . , subprocess.check_call, , 0. , Linux 0, .
:
class Worker(threading.Thread):
def __init__(self, queue):
self.queue = queue
def run(self):
while True:
try:
job = self.queue.get()
subprocess.check_call("myprogram", timeout=my_timeout)
except (TimeoutExpired, subprocess.CalledProcessError):
self.queue.add(job)
: Python 3.5, subprocess.run check
True
.
, , , , , , , Python. threading.Event, " " .
, , . , , , , , , Python - . , Global Interpreter Lock ( PDF), , ( ) - CPU.