|
@@ -674,16 +674,14 @@ static void _starpu_data_unregister(starpu_data_handle_t handle, unsigned cohere
|
|
|
_starpu_spin_unlock(&handle->header_lock);
|
|
|
|
|
|
/* Wait for all requests to finish (notably WT requests) */
|
|
|
+ /* Note: we here tell valgrind that reading busy_count is as
|
|
|
+ * safe is if we had the lock held */
|
|
|
+ _STARPU_VALGRIND_HG_SPIN_LOCK_PRE(&handle->header_lock);
|
|
|
+ _STARPU_VALGRIND_HG_SPIN_LOCK_POST(&handle->header_lock);
|
|
|
STARPU_PTHREAD_MUTEX_LOCK(&handle->busy_mutex);
|
|
|
while (1) {
|
|
|
int busy;
|
|
|
- /* Note: we here tell valgrind that reading busy_count is as
|
|
|
- * safe is if we had the lock held */
|
|
|
- _STARPU_VALGRIND_HG_SPIN_LOCK_PRE(&handle->header_lock);
|
|
|
- _STARPU_VALGRIND_HG_SPIN_LOCK_POST(&handle->header_lock);
|
|
|
busy = handle->busy_count;
|
|
|
- _STARPU_VALGRIND_HG_SPIN_UNLOCK_PRE(&handle->header_lock);
|
|
|
- _STARPU_VALGRIND_HG_SPIN_UNLOCK_POST(&handle->header_lock);
|
|
|
if (!busy)
|
|
|
break;
|
|
|
/* This is woken by _starpu_data_check_not_busy, always called
|
|
@@ -691,6 +689,8 @@ static void _starpu_data_unregister(starpu_data_handle_t handle, unsigned cohere
|
|
|
STARPU_PTHREAD_COND_WAIT(&handle->busy_cond, &handle->busy_mutex);
|
|
|
}
|
|
|
STARPU_PTHREAD_MUTEX_UNLOCK(&handle->busy_mutex);
|
|
|
+ _STARPU_VALGRIND_HG_SPIN_UNLOCK_PRE(&handle->header_lock);
|
|
|
+ _STARPU_VALGRIND_HG_SPIN_UNLOCK_POST(&handle->header_lock);
|
|
|
|
|
|
/* Wait for finished requests to release the handle */
|
|
|
_starpu_spin_lock(&handle->header_lock);
|