Hi, I have a really lengthy and cpu intensive code that currently runs in a separate thread. I inherit from ThreadWithProgressWindow, but because the threaded code uses calls to external libraries, whose running time I cannot control, I am unable to make regular checks on the threadShouldExit(). Plus the code is really lengthy and injecting the checks at various places makes it really ugly and unreadable.
I am considering to force the thread to exit, upon user request, instead of making a couple of dozens of checks and implement a cleanup function which should release allocated resources and related locks…
I don’t like forcing things to happen (it just feels wrong to me…), so any suggestions will be appreciated.
Note that this is my first encounter with JUCE and the solution to the above might be already implemented in it and I am just missing it.