Class: OsCtld::Console::Container
- Inherits:
-
Object
- Object
- OsCtld::Console::Container
- Defined in:
- lib/osctld/console/container.rb
Overview
Instance per container, each holding a list of opened ttys
Instance Attribute Summary collapse
-
#ct ⇒ Object
readonly
Returns the value of attribute ct.
Instance Method Summary collapse
- #add_client(tty_n, io) ⇒ Object
- #close_all ⇒ Object
- #connect_tty0(pid, socket) ⇒ Object
-
#initialize(ct) ⇒ Container
constructor
A new instance of Container.
- #sync ⇒ Object protected
- #tty(n) ⇒ Object
Constructor Details
#initialize(ct) ⇒ Container
Returns a new instance of Container.
8 9 10 11 12 |
# File 'lib/osctld/console/container.rb', line 8 def initialize(ct) @ct = ct @ttys = {} @mutex = Mutex.new end |
Instance Attribute Details
#ct ⇒ Object (readonly)
Returns the value of attribute ct.
6 7 8 |
# File 'lib/osctld/console/container.rb', line 6 def ct @ct end |
Instance Method Details
#add_client(tty_n, io) ⇒ Object
14 15 16 |
# File 'lib/osctld/console/container.rb', line 14 def add_client(tty_n, io) tty(tty_n).add_client(io) end |
#close_all ⇒ Object
36 37 38 39 40 |
# File 'lib/osctld/console/container.rb', line 36 def close_all @mutex.synchronize do @ttys.each { |_n, tty| tty.close } end end |
#connect_tty0(pid, socket) ⇒ Object
18 19 20 |
# File 'lib/osctld/console/container.rb', line 18 def connect_tty0(pid, socket) tty(0).connect(pid, socket) end |
#sync ⇒ Object (protected)
43 44 45 |
# File 'lib/osctld/console/container.rb', line 43 def sync @mutex.synchronize { yield } end |