Basic HTML version of Foils prepared 17 Nov 97

Foil 13 Threads and Synchronization II

From Java Tutorial, July 1, 1996 CEWES Tutorial, CPS606, JSU Class CSC499 -- July 22-25 1997, Fall 97. by Nancy J. McCracken,Geoffrey C. Fox, Tom Scavo


void notify()
void notifyAll()
  • These methods must be called from a synchronized method.
  • These methods notify a waiting thread or threads.
notify() notifies the thread associated with the given synchronization object that has been waiting the longest time
notifyAll() notifies all threads associated with the given object and is therefore safer than notify()
One can mark a variable as "threadsafe" to inform the compiler that only one thread will be modifying this variable.



© 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 Wed Apr 1 1998