Here are several approaches for synchronization around a pool of limited resources that are checked in and out by a gang of threads.
There are three different pools: MonitorPool
which uses monitor.rb
, MutexCondvarPool
which uses a Mutex
and a ConditionVariable
, and SemaphorePool
which uses a java.util.concurrent.Semaphore
(only under JRuby).