Chapter 6. Synchronization
APIs Used in This Chapter
The Class java.lang.Object
The Class Extensions.Semaphore
The Class Extensions.Mutex
The Class Extensions.ConditionVar
In which the reader is led on a hunt for the intimidating synchronization variable and discovers that it is not actually as frightening as had been thought. Programs illustrating the basic use of the POSIX and Java primitives are shown.
To write any kind of concurrent program, you must be able to synchronize the different threads reliably. Failure to do so will result in all sorts of ugly, messy bugs. Without synchronization, two threads will start to change some data at the same time; one will overwrite the other. ...