Zach Smith
Zach Smith

Reputation: 8971

What happens if two processes call File.read(path) at the same time for the same path in Ruby?

If I have two child processes in Ruby, and each calls `File.read()' at the same time (on the same file), what will happen?

What I want to happens is that both processes just read the contents of the file...

Upvotes: 1

Views: 42

Answers (1)

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230521

Read is a safe operation. You can have however many concurrent readers.

Not so with writes, naturally.

So yeah, what you expect is what will likely happen.

Upvotes: 3

Related Questions