mutex error while throttling down a phenom CPU

Kevin Kofler kevin.kofler at chello.at
Sun Jan 18 23:26:45 UTC 2009


Joerg Bergmann wrote:
> Solved. gcc did reorder some mutex related counter/bool assignments
> which should be done right in order. They come in from an argument
> pointer, so I did trust this order. Have set them to volatile, that
> did fix the bug. Is this a new gcc feature or a gcc bug?

Optimization feature, most likely.

Only system mutexes (POSIX, OpenMP etc.) and some GCC extensions (e.g.
__sync_fetch_and_add) are guaranteed to be thread-safe, custom hacks can
often be a source of trouble (and I'm not sure volatile is a complete fix -
for counters, it can even be counterproductive, as it normally generates
read/add/write sequences, not in-place adds).

        Kevin Kofler




More information about the fedora-test-list mailing list