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.



224
225
226
227
# File 'lib/pwrake/queue/queue_array.rb', line 224

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

Instance Method Details

#delete(t) ⇒ Object



239
240
241
242
243
244
# File 'lib/pwrake/queue/queue_array.rb', line 239

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

#pop_super(host_info) ⇒ Object



246
247
248
# File 'lib/pwrake/queue/queue_array.rb', line 246

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

#push(t) ⇒ Object



229
230
231
232
# File 'lib/pwrake/queue/queue_array.rb', line 229

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

#shift(host_info = nil) ⇒ Object



234
235
236
237
# File 'lib/pwrake/queue/queue_array.rb', line 234

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