Class: Yoda::Server::ConcurrentWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/server/concurrent_writer.rb

Overview

Wrapper class for writer to make thread safe

Instance Method Summary collapse

Constructor Details

#initialize(channel) ⇒ ConcurrentWriter

Returns a new instance of ConcurrentWriter.

Parameters:

  • (::LanguageServer::Protocol::Transport::Stdio::Writer)


6
7
8
9
# File 'lib/yoda/server/concurrent_writer.rb', line 6

def initialize(channel)
  @channel = channel
  @mutex = Mutex.new
end

Instance Method Details

#write(*args) ⇒ Object



11
12
13
# File 'lib/yoda/server/concurrent_writer.rb', line 11

def write(*args)
  @mutex.synchronize { @channel.write(*args) }
end