mutex error while throttling down a phenom CPU

James Hubbard jameshubbard at gmail.com
Mon Jan 19 00:36:56 UTC 2009


On Sun, Jan 18, 2009 at 6:26 PM, Kevin Kofler <kevin.kofler at chello.at> wrote:
> 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).

Herb Sutter has an article on volatile and proper concurrency
mechanisms.  The way in which you've used volatile may not be correct.
http://herbsutter.wordpress.com/2009/01/12/effective-concurrency-volatile-vs-volatile/




More information about the fedora-test-list mailing list