Application hangs with mutliple threads in atomicity functions

Chad Attermann chad@broadmind.com
Thu Nov 15 19:28:00 GMT 2007


> Well, you should be able to step through these atomic functions and
> see what they're doing: as they're at 100% cpu they aren't waiting on
> mutexes.  So, attach your trusty debugger to the threads and
> single-step to see what's going on.

Again I am not as familiar as I would like to be with the internals of gcc 
or libstdc++, but I understand that the atomic functions employ spin-locks 
for efficiency.  If that is the case then wouldn't they spin perpetually and 
consume 100% CPU if dead-lock were to occur?  This was just an assumption, 
but I will take your advice and step in with the debugger to verify.

> Valgrind would almost certainly help you here, but Solaris isn't
> supported.  Purify does support Solaris, but costs real money.

Great suggestion.  I will try building it in Linux and take advantage of 
Valgrind.



More information about the Gcc-help mailing list