db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@debrunners.com>
Subject Re: Class loading deadlock
Date Thu, 15 Sep 2005 16:07:08 GMT
Andreas Fredriksson wrote:

> On Thu, 2005-09-15 at 07:39 -0700, Daniel John Debrunner wrote:
>>I'm more talking from a functional level. Even with the synchronization
>>the caller of the method is just seeing a value from the past, no
>>guarantees over it being the "latest" once the method returns. As soon
>>as the synchronization is released, ten other threads could execute and
>>change the value and our original caller already has a stale value
>>before they operate on it.
> The point I was trying to make is that if there are no locks involved at
> all, and only a single write of a field (as appears to be the case
> here), a reader might theoretically never see the written value, ever,
> as the view of memory only passes when the writer threads enters a
> monitor.

I think we are in agreement and are just pointing out different, but
correct, aspects of synchronization.

In the case of the action variable, it can be set multiple times, and
the setting of it is syncnronized with the reading of it. Ie. the caller
sets it, the calls the doPriv method and in the resulting call to the
run method the action variable is read to determine which action to
take. All of this happens under a single synchronized block, which your
patch changed.


View raw message