[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Coroutines and Go
- From: "Matthew P. Del Buono" <delbu9c1@...>
- Date: Thu, 12 Nov 2009 10:07:23 -0500
Cheng, Long wrote:
> As before, there is no guarantee that, in |main|, observing the write to
> |done| implies observing the write to |a|, so this program could print
> an empty string too. Worse, there is no guarantee that the write to
> |done| will ever be observed by |main|, since there are no
> synchronization events between the two threads. The loop in |main| is
> not guaranteed to finish.
I don't really see a problem with this. It works the same in C++ for any
decent compiler, and is one of the primary purposes of the keyword
'volatile.'
-- Matthew P. Del Buono