rnk added a comment. It's actually important for performance to compile out this mutex when threading is disabled. We do this in Chromium and apparently it matters. If you implement Rafael's suggestion you can avoid the lock entirely. http://reviews.llvm.org/D21520