Fawzi Mohamed wrote:
On 2008-12-07 03:48:40 +0100, Sean Kelly <[EMAIL PROTECTED]> said:
Not true. You would need an acquire barrier in thread_needLock.
However, on x86 the point is probably moot since loads have acquire
semantics anyway.
You would need a very good processor to reorder speculative loads before
a function call and a branch. As far as I know even alpha did not do it.
But if thread_needLock() is inlined...
A volatile statement will probably be enough in all cases, but you are
right that to be really correct a load barrier should be done, an even
in a processor where this might matter the cost of it in the fast path
will be basically 0 (so still better than a lock).
Aye. I'd do this if there were a common use case that justified it, but
I don't see one.
Sean