Explorar o código

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

Cédric Augonnet %!s(int64=15) %!d(string=hai) anos
pai
achega
84acefca8d
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  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);