up previous next contents
Next: Thread references Up: Threads Previous: Creating a threaded class   Contents

Thread methods

  • sleep(long ms) - causes the thread to sleep for the specified number of milliseconds.
  • yield() - provides a hint to the scheduler that this doesn't have to run at the current time, so the scheduler can choose another thread to run if need be.
  • join() - used to let one thread wait for another to terminate.
  • interrupt() - used to request that the thread cancel itself.
  • notifyAll() - wakes up all waiting threads.
  • wait() - used to pause the thread, presumably while it waits for some condition to be satisfied.


up previous next contents
Next: Thread references Up: Threads Previous: Creating a threaded class   Contents