Class: DatTCP::WorkersWaiting
- Inherits:
-
Object
- Object
- DatTCP::WorkersWaiting
- Defined in:
- lib/dat-tcp/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.
209 210 211 212 |
# File 'lib/dat-tcp/worker_pool.rb', line 209 def initialize @mutex = Mutex.new @count = 0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
207 208 209 |
# File 'lib/dat-tcp/worker_pool.rb', line 207 def count @count end |
Instance Method Details
#decrement ⇒ Object
218 219 220 |
# File 'lib/dat-tcp/worker_pool.rb', line 218 def decrement @mutex.synchronize{ @count -= 1 } end |
#increment ⇒ Object
214 215 216 |
# File 'lib/dat-tcp/worker_pool.rb', line 214 def increment @mutex.synchronize{ @count += 1 } end |