Skip to main content

Condition Variables and Counting Semaphores

  • Chapter
  • 236 Accesses

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

eBook
USD   24.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   34.95
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Authors

Rights and permissions

Reprints 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

Publish with us

Policies and ethics