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.



190
191
192
193
# File 'lib/pwrake/queue/queue_array.rb', line 190

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

Instance Method Details

#delete(t) ⇒ Object



205
206
207
208
209
210
# File 'lib/pwrake/queue/queue_array.rb', line 205

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

#pop_super(host_info) ⇒ Object



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

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

#push(t) ⇒ Object



195
196
197
198
# File 'lib/pwrake/queue/queue_array.rb', line 195

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

#shift(host_info) ⇒ Object



200
201
202
203
# File 'lib/pwrake/queue/queue_array.rb', line 200

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