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

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

Constructor Details

#initialize(nproc) ⇒ LifoHrfQueueArray

Returns a new instance of LifoHrfQueueArray.



134
135
136
137
# File 'lib/pwrake/queue/queue_array.rb', line 134

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

Instance Method Details

#delete(t) ⇒ Object



149
150
151
152
153
154
# File 'lib/pwrake/queue/queue_array.rb', line 149

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

#pop_super(host_info, rank) ⇒ Object



156
157
158
# File 'lib/pwrake/queue/queue_array.rb', line 156

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

#push(t) ⇒ Object



139
140
141
142
# File 'lib/pwrake/queue/queue_array.rb', line 139

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

#shift(host_info, rank) ⇒ Object



144
145
146
147
# File 'lib/pwrake/queue/queue_array.rb', line 144

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