Hi,
On this subject, given (say) the following situation, what's a good way of
stopping the thread ASAP (if abort() is not well regarded)? :
- A main UI thread that can spawn preview windows
- Each preview window has a thread it uses to calculate stuff to display
in itself. These operations can be lengthy and not easily split down to
(say) less than a second of time
- The preview worker threads don't contain any resources that require
explicit destruction (they contain only value types, for example)
If you want to close a preview window, you don't want to wait for a second
for the worker thread to finish. One solution is to do something to the
worker that means that when it finishes, it just drops its calculation, but
that doesn't seem good to me.
So given that, is there an acceptable way of killing the thread off (for
example refactoring the worker thread so it is more granular)? We're sort of
in this situation (except our threads are executing some unmanaged C++ code
that's extremely processor intensive and not easily interrupted nicely),
andso far I've not come up with a nice solution.
Cheers,
Steve