Faster stats, Adaptive mutexes and Coverity report fixes 

* Removed 3 system calls per stat update which should speed up insert/remove.
* Switched to adaptive mutexes (mutexes that spin for some time, then block).
* Fixed numerous Coverity errors.

PS. Fix for agodin@ failed night tests -> needs debug. I'll get to it when have spare time.