瀏覽代碼

Fix missplaced mutex : a task can be added to the list after the test to check if the list was empty

Corentin Salingue 8 年之前
父節點
當前提交
1f1629ff35
共有 1 個文件被更改,包括 3 次插入4 次删除
  1. 3 4
      src/core/dependencies/data_arbiter_concurrency.c

+ 3 - 4
src/core/dependencies/data_arbiter_concurrency.c

@@ -542,16 +542,15 @@ void _starpu_notify_arbitered_dependencies(starpu_data_handle_t handle)
 	/* Since the request has been posted the handle may have been proceed and released */
 	if (_starpu_data_requester_list_empty(&handle->arbitered_req_list))
 	{
-#ifndef LOCK_OR_DELEGATE
-		STARPU_PTHREAD_MUTEX_UNLOCK(&arbiter->mutex);
-#endif
-
 		/* No waiter, just remove our reference */
 		_starpu_spin_lock(&handle->header_lock);
 		STARPU_ASSERT(handle->refcnt > 0);
 		handle->refcnt--;
 		STARPU_ASSERT(handle->busy_count > 0);
 		handle->busy_count--;
+#ifndef LOCK_OR_DELEGATE
+		STARPU_PTHREAD_MUTEX_UNLOCK(&arbiter->mutex);
+#endif
 		if (_starpu_data_check_not_busy(handle))
 			/* Handle was even destroyed, don't unlock it.  */
 			return;