This reverts commit 1f71bcab. Some platform have global destructors for std::mutex that still needs to be fixed.