Class: DatWorkerPool::WorkersWaiting
- Inherits:
-
Object
- Object
- DatWorkerPool::WorkersWaiting
- Defined in:
- lib/dat-worker-pool.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
Instance Method Summary collapse
- #decrement ⇒ Object
- #increment ⇒ Object
-
#initialize ⇒ WorkersWaiting
constructor
A new instance of WorkersWaiting.
Constructor Details
#initialize ⇒ WorkersWaiting
Returns a new instance of WorkersWaiting.
183 184 185 186 |
# File 'lib/dat-worker-pool.rb', line 183 def initialize @mutex = Mutex.new @count = 0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
181 182 183 |
# File 'lib/dat-worker-pool.rb', line 181 def count @count end |
Instance Method Details
#decrement ⇒ Object
192 193 194 |
# File 'lib/dat-worker-pool.rb', line 192 def decrement @mutex.synchronize{ @count -= 1 } end |
#increment ⇒ Object
188 189 190 |
# File 'lib/dat-worker-pool.rb', line 188 def increment @mutex.synchronize{ @count += 1 } end |