diff options
author | Jason Carey <jcarey@argv.me> | 2018-08-17 11:21:21 -0400 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2018-08-21 11:24:25 -0400 |
commit | e5fd0cd67b6eabb44fbaa00a0b202eb17f7b09f8 (patch) | |
tree | 7a837d7e3ca2f33336a809be72e86e77006ca711 /src/mongo/util/concurrency/spin_lock.cpp | |
parent | 14c53602360e9c223e70f97c2b08760df194f996 (diff) | |
download | mongo-e5fd0cd67b6eabb44fbaa00a0b202eb17f7b09f8.tar.gz |
SERVER-36676 spinlock as mutex in dbg builds linux
We have some lovely deadlock detection code built into the hang analyzer
on linux which does a great job with our internal lock types as well as
with mutexes. For debug builds, backing SpinLock's with mutexes gives us
that deadlock detection for free.
This constrains them from being released on a different thread, but
critical sections already have that property, so we can't have been
relying on it.
Diffstat (limited to 'src/mongo/util/concurrency/spin_lock.cpp')
-rw-r--r-- | src/mongo/util/concurrency/spin_lock.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/util/concurrency/spin_lock.cpp b/src/mongo/util/concurrency/spin_lock.cpp index 60fbcd75486..bd4bfa2d359 100644 --- a/src/mongo/util/concurrency/spin_lock.cpp +++ b/src/mongo/util/concurrency/spin_lock.cpp @@ -27,16 +27,17 @@ * then also delete it in the license file. */ -#if !defined(_WIN32) - #include "mongo/platform/basic.h" -#include "mongo/platform/pause.h" -#include "mongo/util/concurrency/spin_lock.h" +#include "mongo/config.h" + +#if !(defined(_WIN32) || MONGO_CONFIG_DEBUG_BUILD) #include <sched.h> #include <time.h> +#include "mongo/platform/pause.h" +#include "mongo/util/concurrency/spin_lock.h" namespace mongo { |