[concurrency-interest] HalfSync

Jeremy Manson jmanson at cs.purdue.edu
Wed May 24 18:41:23 EDT 2006


David Holmes wrote:
> Jeremy writes:
>> This isn't as thread safe as it would be if both were synchronized.
> ...
>> Even if Thread 2 terminates, Thread 1 might not, because there is no
>> happens-before edge from Thread 2's increment to Thread 1.  If getCount
>> were synchronized, then Thread 1 would terminate if Thread 2 did.
> 
> Huh? count is volatile.
> 

Sorry, missed that, my bad.

					Jeremy


More information about the Concurrency-interest mailing list