Module: Mycel::Transport::Mixin::Server::Auto

Included in:
AutoServant, AutoServer
Defined in:
lib/mycel.rb

Instance Method Summary collapse

Instance Method Details

#closeObject



260
261
262
263
264
265
266
# File 'lib/mycel.rb', line 260

def close
  @thread_lock.synchronize {
    super
    @thread.join if @thread && @thread != Thread.current
    @thread = nil
  }
end

#initialize(*args, **named_args) ⇒ Object



242
243
244
245
246
# File 'lib/mycel.rb', line 242

def initialize(*args, **named_args)
  super
  @thread = nil
  @thread_lock = Monitor.new   # consistent with the rest of the lib
end

#open(*args, **named_args) ⇒ Object



248
249
250
251
252
253
254
255
256
257
258
# File 'lib/mycel.rb', line 248

def open(*args, **named_args)
  @thread_lock.synchronize {
    super
    @thread = Thread.new {
      begin
        loop { self.connect_this }
      rescue IOError
      end
    }
  }
end