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.
6 7 8 9 10 |
# File 'lib/osctld/console/container.rb', line 6 def initialize(ct) @ct = ct @ttys = {} @mutex = Mutex.new end |
Instance Attribute Details
#ct ⇒ Object (readonly)
Returns the value of attribute ct.
4 5 6 |
# File 'lib/osctld/console/container.rb', line 4 def ct @ct end |
Instance Method Details
#add_client(tty_n, io) ⇒ Object
12 13 14 |
# File 'lib/osctld/console/container.rb', line 12 def add_client(tty_n, io) tty(tty_n).add_client(io) end |
#close_all ⇒ Object
34 35 36 37 38 |
# File 'lib/osctld/console/container.rb', line 34 def close_all @mutex.synchronize do @ttys.each_value(&:close) end end |
#connect_tty0(pid, socket) ⇒ Object
16 17 18 |
# File 'lib/osctld/console/container.rb', line 16 def connect_tty0(pid, socket) tty(0).connect(pid, socket) end |
#sync ⇒ Object (protected)
42 43 44 |
# File 'lib/osctld/console/container.rb', line 42 def sync(&) @mutex.synchronize(&) end |