> It strikes me that the H/W designers have played a bit "fast and
> loose" with
> the cache consistency issue here
For the vast majority of cases, this is a pure speed boost. For the tiny
number of cases where it causes a problem, you use mutexes.
> - I believe I understand the C/C++
> optimisation issues, and these CAN be worked around (IMHO) within
> the rules
> of the standard by using bool in some cases.
If you mean 'volatile', no, that doesn't do anything. Specifically,
'volatile' has no special semantics for multi-processors. There may be
specific compilers where it has such semantics, but the standard doesn't
provide them.
This is a frequently-spread bit of misinformation, largely due to
specific
cases wher 'volatile' has been made to have such semantics by magic that's
not clearly visible in the cases. If the C standard really prohibited a
compiler from re-ordering writes to volatile variables, it would likewise
prohibit the cache from doing so. Do you know of any C implementations that
make writes to volatile variables bypass write-back caches?
> However I've notified our dev folks to remove the few cases where
> we've used
> this technique as it is certainly dangerous.
Thanks.
DS
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]