Basic HTML version of Foils prepared 18 May 97

Foil 10 Threads and Synchronization - notify()

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 Threadsafe Variables
2 void notify()
3 void notifyAll()
  • The notify() and notifyall() methods are part of the Object class, and hence available for every object.
  • These methods must be called from a synchronized method.
  • These methods simply notifies a thread that is waiting.
4 notify() notifies the thread associated with given synchronization object that has been waiting the longest time
5 notifyall() notifies all threads associated with given object
6 One can mark a variable as "threadsafe" to notify the compiler that only one thread will be modifying this variable.

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