atomic operations in mt alloc

Stefan Olsson stefan@xapa.se
Mon Mar 15 08:44:00 GMT 2004


Hi all,

in an off-list discussion Dhruv pointed out to me that the free & used 
counters are size_t variables that could become corrupted since they are 
not atomic.

If this were to happen it would affect the behaviour of the remove 
calculation (however since all list operations are made on the actual 
pointers a crash due to this is _very_ unlikely).

Here's a question: As far as I can tell an _Atomic_word is defined to at 
least an integer across all platforms. Can this be trusted? If I were to 
use this instead of size_t I need to know that it's never actually a word...

Brgds

/Stefan




More information about the Libstdc++ mailing list