This chapter introduces two more semaphores and rounds out the set of basic synchronization objects that you’ll need to get real work done. Like the Mutex I presented in Chapter 3, these classes duplicate the abilities of the Java language to some extent, but like the Mutex, I’ve fixed some problems (and added some capabilities) with the Java language implementations. I’ll look at two classes: (1) a condition variable that adds to wait() the ability to not wait when the event you’re waiting for has already taken place, and (2) a counting semaphore that lets you control a pool of resources without sucking up machine cycles in polling loops.
KeywordsCondition Object Final Class Public Class Class File Polling Loop
Unable to display preview. Download preview PDF.