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.
121 122 123 124 |
# File 'lib/dat-worker-pool.rb', line 121 def initialize @mutex = Mutex.new @count = 0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
119 120 121 |
# File 'lib/dat-worker-pool.rb', line 119 def count @count end |
Instance Method Details
#decrement ⇒ Object
130 131 132 |
# File 'lib/dat-worker-pool.rb', line 130 def decrement @mutex.synchronize{ @count -= 1 } end |
#increment ⇒ Object
126 127 128 |
# File 'lib/dat-worker-pool.rb', line 126 def increment @mutex.synchronize{ @count += 1 } end |