mongodb/mongo — pull request #198 by janimo (2012-03-28 12:55:55+00:00)
Title: db/stats/counters code causes SIGBUS on ARM

On ARM accessing unaligned words via atomic load and store instructions
causes alignment faults and crashes the application. This is an issue
for the statistics counters which are AtomicUInts and can be in BSON
data, thus unaligned. This change introduces CounterUInt which is an
alias for AtomicUInt but can be made a simple UInt on ARM or other
architectures with such constraints.

If this looks ok (I ws not sure whether to use a #define instead of typedef and for the latter make it private or not) a simple #ifdef can make the ARM code use an unsigned int. Not thread safe but as the comments in the same file notes that is not a prio for counters. AtomicUInt definitely needs to remain used in all other places on ARM (pointers outside BSON data)