No public description

PiperOrigin-RevId: 659640141
Change-Id: I5b3579480d96954f871f1706668811a5adeb001f
diff --git a/Eigen/ThreadPool b/Eigen/ThreadPool
index 0b1d1a0..63e4758 100644
--- a/Eigen/ThreadPool
+++ b/Eigen/ThreadPool
@@ -51,30 +51,52 @@
 #include "src/Core/util/Meta.h"
 #include "src/Core/util/MaxSizeVector.h"
 
-#ifdef EIGEN_USE_CUSTOM_THREAD_POOL
-#ifndef EIGEN_MUTEX
+// Use ABSL synchronization primitives, unless it's explicitly disabled with
+// EIGEN_USE_STD_SYNCHRONIZATION for platforms that can't compile ABSL headers
+#if !defined(EIGEN_USE_STD_SYNCHRONIZATION)
+#include "third_party/absl/base/thread_annotations.h"
+#include "third_party/absl/synchronization/mutex.h"
+#else
 #define EIGEN_MUTEX std::mutex
-#endif
-#ifndef EIGEN_MUTEX_LOCK
 #define EIGEN_MUTEX_LOCK std::unique_lock<std::mutex>
-#endif
-#ifndef EIGEN_CONDVAR
 #define EIGEN_CONDVAR std::condition_variable
 #endif
-#else
-  // Use tensorflow synchronization primitives.
-  #if !defined(EIGEN_MUTEX) || !defined(EIGEN_MUTEX_LOCK) || !defined(EIGEN_CONDVAR)
-    #include "third_party/tensorflow/tsl/platform/mutex.h"
-  #endif
-  #ifndef EIGEN_MUTEX
-    #define EIGEN_MUTEX ::tsl::mutex
-  #endif
-  #ifndef EIGEN_MUTEX_LOCK
-    #define EIGEN_MUTEX_LOCK ::tsl::mutex_lock
-  #endif
-  #ifndef EIGEN_CONDVAR
-    #define EIGEN_CONDVAR ::tsl::condition_variable
-  #endif
+
+#ifndef EIGEN_MUTEX
+namespace Eigen {
+struct ABSL_LOCKABLE Mutex {
+  absl::Mutex mu;
+};
+} // namespace Eigen
+
+#define EIGEN_MUTEX ::Eigen::Mutex
+#endif
+
+#ifndef EIGEN_MUTEX_LOCK
+namespace Eigen {
+struct ABSL_SCOPED_LOCKABLE MutexLock {
+  explicit MutexLock(Mutex& mutex) ABSL_EXCLUSIVE_LOCK_FUNCTION(mutex)
+      : mu(&mutex.mu), lock(mu) {}
+  ~MutexLock() ABSL_UNLOCK_FUNCTION() = default;
+  absl::Mutex* mu;
+  absl::MutexLock lock;
+};
+} // namespace Eigen
+
+#define EIGEN_MUTEX_LOCK ::Eigen::MutexLock
+#endif
+
+#ifndef EIGEN_CONDVAR
+namespace Eigen {
+struct CondVar {
+  void wait(MutexLock& lock) { cv.Wait(lock.mu); }
+  void notify_one() { cv.Signal(); }
+  void notify_all() { cv.SignalAll(); }
+  absl::CondVar cv;
+};
+} // namespace Eigen
+
+#define EIGEN_CONDVAR ::Eigen::CondVar
 #endif