I have a function in a ruby ββfile that writes to a file like this
File.open("myfile", 'a') { |f| f.puts("#{sometext}") }
This function is called in different threads, which makes the file entry as shown above, not thread safe. Does anyone know how to make this file write-safe by stream in the simplest way?
Additional Information: If it matters, I use the rspec framework.
source
share