Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> writes: > ... > *If* Python was a different language, I would spawn two threads, one using > SHORT and the other using LARGE, then which ever completes first, I'd just > kill the other. Alas, this won't work because (1) the GIL
The GIL does not prevent this scenario. The two threads will not really run in parallel but interleaved - but this should not be a big problem. > and (2) you > cannot forcibly kill threads, only ask them to die and hope they listen. You can kill threads (though you will need a "C" level function for this) as long as they execute Python code. And it is your code: you can make your threads be listening, from time to time in the computation. -- https://mail.python.org/mailman/listinfo/python-list