code: public void kill() {
          die = true;
          lock.activate(); // wake up the sleeping thread.
  
          // wait for it to die. if someone interrupts us, process that later.
          try {
              join();
          } catch (InterruptedException e) {
              Thread.currentThread().interrupt();
          }
      }
docs: Kills this {@link ComThread} gracefully
  and blocks until a thread dies.