[concurrency-interest] Question about "happens-before" and reordering

Pete Soper Pete.Soper at Sun.COM
Fri May 19 10:05:04 EDT 2006


Giuliano Mega wrote:
>> So, unless I'm talking nonsense (in which case I would politely ask
>> for someone to correct me), this means that what happens at the
>> constructor must be visible at the finalizer, for all threads.
>> Although the instructions may be reordered, the resulting execution
>> must be "legal" in the sense that it must reflect a possible
>> execution. In your example, if an exception is thrown at the security
>> check, then the flag must be seen as false at the finalizer as it is
>> the only legal option.
> 
> 
> I'm sorry for posting again, but I just re-read my answer and found it
> confusing. What I wanted to say is that the reordering that occurs
> inside of the constructor must respect local ordering within a single
> thread of control, and that the changes that were performed by the
> constructor must have been already commited to main memory when the
> finalizer begins, or the constructor won't appear to have
> happenned-before the finalizer (and the spec says it must).

This seemed quite clear the first time. More fundamentally, if the 
constructor never completes, the finalizer's running is impossible, right?

> 
> Best,
> 



More information about the Concurrency-interest mailing list