Method: Fairy::SortedQueue#initialize
- Defined in:
- lib/fairy/share/port.rb
#initialize(policy, queue_mon = XThread::Monitor.new, queue_cv = queue_mon.new_cond) ⇒ SortedQueue
Returns a new instance of SortedQueue.
1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 |
# File 'lib/fairy/share/port.rb', line 1392 def initialize(policy, queue_mon = XThread::Monitor.new, queue_cv = queue_mon.new_cond) @policy = policy @pool_threshold = policy[:pool_threshold] @pool_threshold ||= CONF.SORTEDQUEUE_POOL_THRESHOLD @threshold = policy[:threshold] @threshold ||= CONF.SORTEDQUEUE_THRESHOLD @push_queue = [] @pop_queue = nil @buffers = nil @queue_mon = queue_mon @queue_cv = queue_cv @sort_by = policy[:sort_by] @sort_by ||= CONF.SORTEDQUEUE_SORTBY if @sort_by.kind_of?(String) @sort_by = eval("proc{#{@sort_by}}") end end |