Thread.sleep (250);
synchronized (t) { while (!t.ready) t.wait(10); }  Thread.sleep (50);
  public static void sleep_and_interrupt(Thread t)  {    try    {      Thread.sleep (250);      t.interrupt ();      long t1 = System.currentTimeMillis();      t.join (5000);      long time = System.currentTimeMillis() - t1;      if (time > 2900)        {	  System.out.println ("Error: join() from main thread timed out");	}    }    catch (InterruptedException x)    {      System.out.println("Error: main thread interrupted.");    }  }