Class: Hydra::ThreadsafeIO
- Inherits:
-
IO
- Object
- IO
- Hydra::ThreadsafeIO
- Defined in:
- lib/hydra/threadsafe_io.rb
Instance Method Summary collapse
-
#initialize(existing_io) ⇒ ThreadsafeIO
constructor
A new instance of ThreadsafeIO.
- #write(*args) ⇒ Object
Constructor Details
#initialize(existing_io) ⇒ ThreadsafeIO
Returns a new instance of ThreadsafeIO.
6 7 8 9 10 |
# File 'lib/hydra/threadsafe_io.rb', line 6 def initialize(existing_io) fd = existing_io.fcntl(Fcntl::F_DUPFD) super(fd) @mutex = Mutex.new end |
Instance Method Details
#write(*args) ⇒ Object
12 13 14 15 16 |
# File 'lib/hydra/threadsafe_io.rb', line 12 def write(*args) @mutex.synchronize do super(*args) end end |