Kaynağa Gözat

Add some sanity check to make sure that a try-lock is not failing because of an
actual error.

Cédric Augonnet 15 yıl önce
ebeveyn
işleme
84acefca8d
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 3 1
      src/common/starpu_spinlock.c

+ 3 - 1
src/common/starpu_spinlock.c

@@ -54,7 +54,9 @@ int _starpu_spin_lock(starpu_spinlock_t *lock)
 int _starpu_spin_trylock(starpu_spinlock_t *lock)
 {
 #ifdef HAVE_PTHREAD_SPIN_LOCK
-	return pthread_spin_trylock(&lock->lock);
+	int ret =  pthread_spin_trylock(&lock->lock);
+	STARPU_ASSERT(!ret || (ret == EBUSY));
+	return ret;
 #else
 	uint32_t prev;
 	prev = STARPU_TEST_AND_SET(&lock->taken, 1);