Abstract
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.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2000 Allen I. Holub
About this chapter
Cite this chapter
Holub, A. (2000). Condition Variables and Counting Semaphores. In: Taming Java Threads. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-1129-7_4
Download citation
DOI: https://doi.org/10.1007/978-1-4302-1129-7_4
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-893115-10-1
Online ISBN: 978-1-4302-1129-7
eBook Packages: Springer Book Archive