img
. . . .
Reference:
Chapter 6.
unlock
public void unlock()
This unlocks the mutex, waking up one thread (if any are sleeping).
Chapter 6.
Reference:
The Class Extensions.ConditionVar
This is one of our classes. It implements POSIX-style condition variables. Use only when
synchronized sections and wait/notify won't work.
condWait
public void condWait(Mutex m)
This causes the current thread to block until it is awakened by either a call to condSignal() or
by a spurious wakeup (not by interruption). It will release the mutex lock for the object as it goes
to sleep, and reacquire it before returning.
Reference:
Chapter 6.
condSignal condBroadcast
public void condSignal()
public void condBroadcast()
These cause (one/all) of the threads that are in a condWait() call to wake up and return.
Reference:
Chapter 6.
Summary
The main issue in writing MT programs is how to get threads to work together. Locks
(synchronized sections) and condition variables (wait/notify) are the fundamental building blocks
from which anything can be built. Although there are many nonintuitive aspects of
synchronization, most of them can be ignored, as things "just work."
Search WWH :
Custom Search
Previous Page
Multithreaded Programming with JAVA - Topic Index
Next Page
Multithreaded Programming with JAVA - Bookmarks
Home