mutex error while throttling down a phenom CPU

Joerg Bergmann email at jbergmann.de
Mon Jan 19 08:32:30 UTC 2009


Am Montag, den 19.01.2009, 00:26 +0100 schrieb Kevin Kofler:
> 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).

Thanks. I do not need atomic counters. I need only the counter to be set
to its new value before setting the boolean. But, as I have learned
from parallel programming: If one needs atomic counters, he mostly needs
atomic increase-and-check or atomic decrease-and-check. But that
functions seem not to be provided by atomic.h. Are they provided 
elsewhere? Simple atomic increases or atomic decreases are without 
need, in most cases.

Joerg Bergmann




More information about the fedora-test-list mailing list