lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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