Class: OSPFv2::OutputQ
- Includes:
- Observable
- Defined in:
- lib/infra/ospf_io.rb
Instance Attribute Summary collapse
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
-
#initialize(sock, *obs) ⇒ OutputQ
constructor
A new instance of OutputQ.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(sock, *obs) ⇒ OutputQ
Returns a new instance of OutputQ.
107 108 109 110 111 112 |
# File 'lib/infra/ospf_io.rb', line 107 def initialize(sock, *obs) super() @sock= sock obs.each { |o| self.add_observer(o) } @continue = true end |
Instance Attribute Details
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
114 115 116 |
# File 'lib/infra/ospf_io.rb', line 114 def thread @thread end |
Instance Method Details
#start ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/infra/ospf_io.rb', line 122 def start @thread = Thread.new(@sock) do |s| Thread.current['name'] = self.class.to_s begin while @continue el = deq @sock.send(*el) Thread.pass end rescue => e p e end end end |
#stop ⇒ Object
116 117 118 119 120 |
# File 'lib/infra/ospf_io.rb', line 116 def stop @thread.exit @thread.join rescue end |