[Chicago] help with file locking

Dan McGee dpmcgee at gmail.com
Sat Mar 3 05:32:14 CET 2012


On Fri, Mar 2, 2012 at 10:12 PM, Martin Maney <maney at two14.net> wrote:
> On Wed, Feb 29, 2012 at 12:43:56PM -0600, Massimo Di Pierro wrote:
>> Thank you! This helps a lot.
>
> I think there's another problem with a race in the code.  Unlocking
> before closing means that, at least in theory, the reader could open,
> lock, and read the file between the writer's unlock and close, at which
> time the new content hasn't been flushed from the buffers into the OS
> (I was going to say "to disk", but unless you explicitly sync this sort
> of constantly-changing test file may never get to disk at all).

The call to `fp.flush()` that I noted in my first email should have
taken care of this completely; are you seeing otherwise?

-Dan


More information about the Chicago mailing list