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

Giuliano Mega giuliano.mega at gmail.com
Fri May 19 00:58:05 EDT 2006


> 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).

Best,

-- 
Giuliano Mega <giuliano at ime.usp.br>



More information about the Concurrency-interest mailing list