http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47012
--- Comment #8 from js-gcc at webkeks dot org <js-gcc at webkeks dot org> 2010-12-21 11:26:37 UTC --- Hm, a mutex can be a real problem there, I guess. Accessors are used all the time, having a kernel lock each time will be a giant slowdown, especially as most of the time, the lock is not held anyway and if it is, it's only held for a very short period of time. I think this should be changed to spinlocks, even for 4.6. Should I create a bug report for that? If the problem is that we don't know whether we have a spinlock implementation on the system and would need to patch configure.ac and this is too much change before the release, we could just use gcc's __sync_bool_compare_and_swap, spin 10 times and if we still could not acquire our spinlock give control to another process using yield().