Class: Pwrake::LifoHrfQueueArray

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
HrfQueue
Defined in:
lib/pwrake/queue/queue_array.rb

Overview

LIFO + HRF

Instance Method Summary collapse

Methods included from HrfQueue

#check, #hrf_delete, #hrf_get, #hrf_init, #hrf_push, #pop_last_rank

Constructor Details

#initialize(n_cores) ⇒ LifoHrfQueueArray

Returns a new instance of LifoHrfQueueArray.



210
211
212
213
# File 'lib/pwrake/queue/queue_array.rb', line 210

def initialize(n_cores)
  @a = LifoQueueArray.new
  hrf_init(n_cores)
end

Instance Method Details

#delete(t) ⇒ Object



225
226
227
228
229
230
# File 'lib/pwrake/queue/queue_array.rb', line 225

def delete(t)
  if x=@a.delete(t)
    hrf_delete(t)
  end
  x
end

#pop_super(host_info) ⇒ Object



232
233
234
# File 'lib/pwrake/queue/queue_array.rb', line 232

def pop_super(host_info)
  @a.shift(host_info)
end

#push(t) ⇒ Object



215
216
217
218
# File 'lib/pwrake/queue/queue_array.rb', line 215

def push(t)
  @a.push(t)
  hrf_push(t)
end

#shift(host_info = nil) ⇒ Object



220
221
222
223
# File 'lib/pwrake/queue/queue_array.rb', line 220

def shift(host_info=nil)
  return nil if empty?
  hrf_get(host_info)
end