lua-users home
lua-l archive

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


Glenn Maynard wrote:

Just a different idea:

 do
   A = read hook
 while A != read hook

If "hook" is volatile, the compiler should actually do the necessary two
reads here.  This doesn't require sig_atomic_t, which is expensive on
platforms without native atomic opcodes (may require disabling interrupts,
etc).

Yes, but if the thread with this code is reading in between
the non-atomic write of the other thread, are we not back where we
started? :-)

Ralph