This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: PATCH: remove all traces of java.io.FileDescriptor from java.net
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- Cc: Tom Tromey <tromey at redhat dot com>, java-patches at gcc dot gnu dot org
- Date: Thu, 28 Mar 2002 00:04:25 -0500 (EST)
- Subject: Re: PATCH: remove all traces of java.io.FileDescriptor from java.net
On Thu, 28 Mar 2002, Bryce McKinlay wrote:
> OK, that makes sense, but doesn't only finalize() need to be
> synchronized to get the "volatile barrier" behaviour? Or, at least, only
> close(). I don't see why we need to synchronize twice!
I wanted close() to be synchronized because its behavior should be atomic
as seen by a different thread (so that there is no chance of inadvertently
closing the same fd twice).
If finalize() is not synchronized it could theoretically see a stale value
for fnum and end up calling close(-1). That's not a serious flaw however,
and it makes little difference in practice. (Not wishing to explain that
however, I chose to forgo removing it since the benefit would most likely
be negligible in any real application.)
Jeff