Class: Dynflow::Listeners::Socket
- Includes:
- Algebrick::Matching, Serialization
- Defined in:
- lib/dynflow/listeners/socket.rb
Constant Summary collapse
- Terminate =
Algebrick.atom
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
-
#initialize(world, socket_path, interval = 1) ⇒ Socket
constructor
A new instance of Socket.
- #terminate(future = Future.new) ⇒ Object
Methods included from Serialization
#dump, #load, #receive_message, #send_message
Constructor Details
#initialize(world, socket_path, interval = 1) ⇒ Socket
Returns a new instance of Socket.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dynflow/listeners/socket.rb', line 9 def initialize(world, socket_path, interval = 1) super(world) File.delete socket_path if File.exist? socket_path @server = UNIXServer.new socket_path File.chmod(0600, socket_path) @clients = [] @client_barriers = {} @terminate = false @loop = Thread.new do Thread.current.abort_on_exception = true catch(Terminate) { loop { listen(interval) } } @terminate.resolve true end end |