diff --git a/paddle/math/tests/test_perturbation.cpp b/paddle/math/tests/test_perturbation.cpp index 51e346fef91bf8dae7a5084ba8b2d86d9021650b..050f2ca9ced80d18bef2a83f087ee7aa88fa736d 100644 --- a/paddle/math/tests/test_perturbation.cpp +++ b/paddle/math/tests/test_perturbation.cpp @@ -254,4 +254,10 @@ int main(int argc, char** argv) { return RUN_ALL_TESTS(); } +#else + +int main(int argc, char const* argv[]) { + return 0; +} + #endif diff --git a/paddle/utils/arch/osx/Locks.cpp b/paddle/utils/arch/osx/Locks.cpp index 5e0411624fd60cd441d251c14084cd0a1ca42bb5..8fe482ddddd3c214d8a4d3ae29a0b4f54a8d348e 100644 --- a/paddle/utils/arch/osx/Locks.cpp +++ b/paddle/utils/arch/osx/Locks.cpp @@ -49,7 +49,7 @@ void Semaphore::post() { class SpinLockPrivate { public: - SpinLockPrivate(): lock_(0) {} + SpinLockPrivate(): lock_(OS_SPINLOCK_INIT) {} OSSpinLock lock_; char padding_[64 - sizeof(OSSpinLock)]; // Padding to cache line size @@ -92,7 +92,7 @@ public: inline bool wait() { pthread_mutex_lock(&mutex); ++count; - if (count > tripCount) { + if (count >= tripCount) { count = 0; pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mutex);