about summary refs log tree commit diff
path: root/third_party/abseil_cpp/absl/base/internal/spinlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/abseil_cpp/absl/base/internal/spinlock.h')
-rw-r--r--third_party/abseil_cpp/absl/base/internal/spinlock.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/third_party/abseil_cpp/absl/base/internal/spinlock.h b/third_party/abseil_cpp/absl/base/internal/spinlock.h
index 2222398b16b4..e6ac9e6400b2 100644
--- a/third_party/abseil_cpp/absl/base/internal/spinlock.h
+++ b/third_party/abseil_cpp/absl/base/internal/spinlock.h
@@ -64,7 +64,14 @@ class ABSL_LOCKABLE SpinLock {
   constexpr SpinLock(absl::ConstInitType, base_internal::SchedulingMode mode)
       : lockword_(IsCooperative(mode) ? kSpinLockCooperative : 0) {}
 
+  // For global SpinLock instances prefer trivial destructor when possible.
+  // Default but non-trivial destructor in some build configurations causes an
+  // extra static initializer.
+#ifdef ABSL_INTERNAL_HAVE_TSAN_INTERFACE
   ~SpinLock() { ABSL_TSAN_MUTEX_DESTROY(this, __tsan_mutex_not_static); }
+#else
+  ~SpinLock() = default;
+#endif
 
   // Acquire this SpinLock.
   inline void Lock() ABSL_EXCLUSIVE_LOCK_FUNCTION() {