Basic HTML version of Foils prepared 18 May 97

Foil 9 Threads and Synchronization - wait()

From Java Tutorial - Spring 1997 Part 4: Multithreading, useful Java classes, I/O, Networking, and the future Peking Tutorial, Web Certificate -- Spring-Summer 1997. by Nancy J. McCracken,Geoffrey C. Fox


1 void wait()
2 void wait(int timeout)
  • The wait() method is part of the Object class, and hence available for every object.
  • This method simply causes the thread to wait until notified or until the timeout occurs.
  • timeout is an optional argument. If missing or zero, thread waits until notify/notifyall called
  • This method must be called from a synchronized method.
  • wait() will be called while thread owns lock associated with a particular object. wait() releases this lock (atomically i.e. safely)

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Thu Jan 8 1998