Hanson char wrote:
> Is it true that
> 1) the value of "clock" is set by the Garbage Collector,
> 2) so we can assume that this is a stop-the-world event, i.e. only the
> GC runs, and no-one else.
> 3) If we then have several threads that concurrently call get() then
> they should all be set to the same value ?
No. One thread could have read half of clock when it is preempted. A GC
occurs that updates clock. When the original thread resumes it gets a
half-old and half-new timestamp value.
However, given the timestamp is only a hint as to the order in which the GC
might choose to release soft-references, I don't see that the usage
semantics are affected by having a junk timestamp value.
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:09 EDT