Class: ConcurrentWorker::WorkerPool::ReadyWorkerQueue
- Inherits:
- 
      Queue
      
        - Object
- Queue
- ConcurrentWorker::WorkerPool::ReadyWorkerQueue
 
- Defined in:
- lib/concurrent_worker/workerpool.rb
Instance Method Summary collapse
- 
  
    
      #initialize  ⇒ ReadyWorkerQueue 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of ReadyWorkerQueue. 
- #pop ⇒ Object
- #push(arg) ⇒ Object
- #super_pop ⇒ Object
- #super_push ⇒ Object
Constructor Details
#initialize ⇒ ReadyWorkerQueue
Returns a new instance of ReadyWorkerQueue.
| 6 7 8 9 | # File 'lib/concurrent_worker/workerpool.rb', line 6 def initialize super() @m = Mutex.new end | 
Instance Method Details
#pop ⇒ Object
| 15 16 17 18 19 20 21 22 | # File 'lib/concurrent_worker/workerpool.rb', line 15 def pop @m.synchronize do queued = [] queued.push(super_pop) until empty? queued.sort_by{ |w| w.req_counter.size }.each{ |w| super_push(w) } end super_pop end | 
#push(arg) ⇒ Object
| 10 11 12 13 14 | # File 'lib/concurrent_worker/workerpool.rb', line 10 def push(arg) @m.synchronize do super_push(arg) end end | 
#super_pop ⇒ Object
| 5 | # File 'lib/concurrent_worker/workerpool.rb', line 5 alias :super_pop :pop | 
#super_push ⇒ Object
| 4 | # File 'lib/concurrent_worker/workerpool.rb', line 4 alias :super_push :push |