Stopping the execution thread


x::msgdispatcherObj subclasses x::stoppableObj and implements a stop() method which sends a message to the dispatcher thread that throws an exception when its dispatch gets invoked. Unless explicitly caught, the exception terminates the subclass's dispatch loop. This provides a convenient mechanism for stopping the dispatcher thread.