PATCH: remove all traces of java.io.FileDescriptor from java.net
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Wed Mar 27 23:55:00 GMT 2002
Jeff Sturm wrote:
>On Wed, 27 Mar 2002, Bryce McKinlay wrote:
>
>>>Here's my updated patch. Hans convinced me that close/finalize ought to
>>>synchronize access to fnum, I've included that below.
>>>
>>Hmm, why is that? Also I noticed that it is actually synchronizing
>>twice, both in finalize and close?
>>
>
>Finalize and close both access fnum, and will run in different threads. A
>I understand the Java memory model, it is theoretically possible (however
>unlikely) to have the same fd close twice if we don't synchronize.
>
>We'd get the same effect by declaring fnum volatile, if volatile were
>handled correctly.
>
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!
regards
Bryce.
More information about the Java-patches
mailing list