On Sun, Jan 18, 2009 at 6:26 PM, Kevin Kofler <kevin.kofler@xxxxxxxxx> 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/ -- fedora-test-list mailing list fedora-test-list@xxxxxxxxxx To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-test-list