Races between close() and other operations on file channels

Florian Weimer fw at deneb.enyo.de
Mon Aug 6 15:36:56 UTC 2007

* Alan Bateman:

> A few months back I extended it to work with file channels but
> didn't get around to integrating the changes (mostly because Windows
> lacks the APIs in this area and the solution for that platform
> needed more testing).

Ah, good to know.

> Are you running into this problem?

No, fortunately I'm not.  I need to implement flock()-based locking
for interoperability with another programming environment (which, in
turn, does not support fcntl()-based locks).  I wondered what I'd need
to do to avoid this particular race, and looked the OpenJDK sources
for enlightenment, but could not find anything relevant in the file
channel area (I knew about the tricks played with sockets).  This
means that for the time being, I'm going to live with the race.

More information about the core-libs-dev mailing list