Class: ModSpox::Pool::PoolQueue
- Inherits:
-
Queue
- Object
- Queue
- ModSpox::Pool::PoolQueue
- Defined in:
- lib/mod_spox/Pool.rb
Overview
Modified Queue to properly interact with Pool
Instance Method Summary collapse
- #<<(val) ⇒ Object
-
#initialize ⇒ PoolQueue
constructor
A new instance of PoolQueue.
- #pop ⇒ Object
- #push(val) ⇒ Object
Constructor Details
#initialize ⇒ PoolQueue
Returns a new instance of PoolQueue.
148 149 150 151 |
# File 'lib/mod_spox/Pool.rb', line 148 def initialize super @lock = Mutex.new end |
Instance Method Details
#<<(val) ⇒ Object
153 154 155 |
# File 'lib/mod_spox/Pool.rb', line 153 def <<(val) push(val) end |
#pop ⇒ Object
164 165 166 167 168 169 170 171 172 |
# File 'lib/mod_spox/Pool.rb', line 164 def pop @lock.synchronize do if(size > 0) super else raise Exceptions::BotException.new("Queue is currently empty") end end end |
#push(val) ⇒ Object
157 158 159 160 161 162 |
# File 'lib/mod_spox/Pool.rb', line 157 def push(val) @lock.synchronize do super end Pool.process end |