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.
102 103 104 105 106 107 |
# File 'lib/infra/ospf_io.rb', line 102 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.
109 110 111 |
# File 'lib/infra/ospf_io.rb', line 109 def thread @thread end |
Instance Method Details
#start ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/infra/ospf_io.rb', line 117 def start @thread = Thread.new(@sock) do |s| Thread.current['name'] = self.class.to_s begin while @continue el = deq @sock.send(*el) end rescue => e p e end end end |
#stop ⇒ Object
111 112 113 114 115 |
# File 'lib/infra/ospf_io.rb', line 111 def stop @thread.exit @thread.join rescue end |