It's a shame that it's not widely recognized that half of the benefit of threads is to always be able to cleanly cancel them. It helps realize the benefit of thread as background workers.
By cleanly, I mean that locks and resources held should be released, too.
Of course, in the case of file search, subprocessing could probably be used almost as well; just that internal caches and file editing state might not easily be made available to a subprocess.
---
Now at least one of them is gone. But the other persists, searching that file in vain. (There must also be something wrong with the (regex?) pattern match engine or something. I've happened upon regex patterns that would Pattern.compile into exponentially (or even worse?) time-consuming matchers. Unkillable, too.)
---
Ok, now (perhaps 10 minutes later) the other one died.
---
Ok, now (perhaps 10 minutes later) the other one died.
No comments:
Post a Comment