I used a threaded solution, but then switched to a signal one. The work I use is to send SIGTERM from the SIGINT handler, for example:
signal.signal(signal.SIGINT, lambda s, f : os.kill(os.getpid(), signal.SIGTERM))
Here I just want to keep the main idea of ββthe solution so that I can find it faster next time and the reason why I changed the approach. The threaded option is not suitable for me, because OpenMP gets much slower when it is called not from the main thread.
Askold ilvento
source share