Method: Cod::WorkQueue#try_work

Defined in:
lib/cod/work_queue.rb

#try_workObject



37
38
39
40
41
42
43
44
45
46
# File 'lib/cod/work_queue.rb', line 37

def try_work
  exclusive {
    # NOTE if predicate is nil or not set, no work will be accomplished. 
    # This is the way I need it. 
    while !@queue.empty? && predicate?
      wi = @queue.shift
      wi.call
    end
  }
end