Article Rich Public

Smilax needs to be able to stop all threads and shut itself down. This is our approach:

  • Inp and Outp will poll a j_stopPlease bit in BaseJob, which all jobs (threads) in Smilax inherit from. This will allow interrupting work which is reading and writing files.
What if a thread doesn't respond to Thread.interrupt?
In some cases, you can use application specific tricks. For example,
if a thread is waiting on a known socket, you can close the socket
to cause the thread to return immediately. Unfortunately, there
really isn't any technique that works in general. It should be noted
that in all situations where a waiting thread doesn't respond to
Thread.interrupt, it wouldn't respond to Thread.stop either. Such
cases include deliberate denial-of-service attacks, and I/O
operations for which thread.stop and thread.interrupt do not work
properly.
  • BaseJob has a j_queue field. We will put an Err object on the queue. (But actually it will be calling wait(), and interrupt() should kill it.)
  • Infinite loops are still a problem. We might try the depricated Thread.stop() as a last resort? 0ops, the above quote kinda says that wont work either. OK, just exit() the process?