Is it possible for one thread to put another thread in a stop (or sleep)
state? (Unlike Thread.stop which stops the current thread.)
The answer is currently no (Thread#stop was removed at one point), and
Matz has said he doesn’t think this should be allowed:
But what about this case:
I’ve got a threaded app with a DRb-based remote debugging/control
interface. I want to stop all non-DRb threads when the user sends the
“stop” command. The the user (or other external process) can then send
more commands to the DRb interface and inspect stuff without those
threads running around like crazy. Then a later call to the DRb
interface can wakeup all the threads that got stopped.
I can’t use Thread.critical, because the DRb interface has to stay awake
for the next request. None of the threads in the DRb group should be
Setting the priority of the non-DRb threads very low doesn’t seem to
work either–they keep running when the DRb threads are not running.
Any ideas? If Thread#stop is a bad idea, what is the right idea in this