Den 10.03.2011 03:02, skrev Mark Hammond:
These issues are best put in the tracker so they don't get lost -
especially at the moment with lots of regulars at pycon.
Ok, sorry :-)
It would also be good to know if there is an actual behaviour bug
caused by this (ie, what problems can be observed which are caused by
the current code?)
None that I have observed, but this is required according to MSDN.
Theoretically, an optimizing compiler could cache the 'owned' field if
it's not declared volatile. It currently works because a wait on the
lock is implemented with a WaitForSingleObject on a kernel event object
when the waitfalg is set. If the wait mechanism is changed to a much
less expensive user-space spinlock, just releasing the time-slice by
Sleep(0) for each iteration, it will certainly fail without a volatile
qualifier.
As for InterlockedCompareExchange et al., MSDN says this: "The
parameters for this function must be aligned on a 32-bit boundary;
otherwise, the function will behave unpredictably on multiprocessor x86
systems and any non-x86 systems. See _aligned_malloc."
Well, it does not hurt to obey :-)
Regards,
Sturla
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com