Method: OpenC3::Interface#_write

Defined in:
lib/openc3/interfaces/interface.rb

#_writeObject

Wrap all writes in a mutex and handle errors



327
328
329
330
331
332
333
334
335
336
337
# File 'lib/openc3/interfaces/interface.rb', line 327

def _write
  if @write_mutex.owned?
    yield
  else
    @write_mutex.synchronize { yield }
  end
rescue Exception => err
  Logger.error("#{@name}: Error writing to interface")
  disconnect()
  raise err
end