Condition Variables and Counting Semaphores

  • Allen Holub


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.


Condition Object Final Class Public Class Class File Polling Loop 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Allen I. Holub 2000

Authors and Affiliations

  • Allen Holub

There are no affiliations available

Personalised recommendations