Class: Queue

Inherits:
Object
  • Object
show all
Defined in:
lib/hrr_rb_ssh/compat/ruby/queue.rb

Instance Method Summary collapse

Instance Method Details

#__deq__Object



12
# File 'lib/hrr_rb_ssh/compat/ruby/queue.rb', line 12

alias_method :__deq__, :deq

#__enq__Object



11
# File 'lib/hrr_rb_ssh/compat/ruby/queue.rb', line 11

alias_method :__enq__, :enq

#closeObject



14
15
16
# File 'lib/hrr_rb_ssh/compat/ruby/queue.rb', line 14

def close
  @closed = true
end

#closed?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/hrr_rb_ssh/compat/ruby/queue.rb', line 18

def closed?
  @closed == true
end

#deqObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/hrr_rb_ssh/compat/ruby/queue.rb', line 27

def deq
  begin
    Timeout.timeout(0.1) do
      __deq__
    end
  rescue Timeout::Error
    return nil if @closed == true
    retry
  end
end

#enq(arg) ⇒ Object

Raises:



22
23
24
25
# File 'lib/hrr_rb_ssh/compat/ruby/queue.rb', line 22

def enq arg
  raise ClosedQueueError if @closed == true
  __enq__ arg
end