This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]