tags:

views:

50

answers:

2

I am trying to write to a single file from multiple threads. The problem I'm running into is that I don't see anything being written to the file until the program exits.

+4  A: 

You need to file.flush to write it out. You can also set file.sync = true to have it flush automatically.

Peter
A: 

What is the value of the sync method on your io object? It is possible that either ruby or the underlying o/s are buffering the file output.

Check out the refences on buffering and syncing within the documentation

Steve Weet