Kaynağa Gözat

Defer the execution of the callback associated to a request after the handle's
lock is released, so that the callback may also submit request to the handle
(or simply release the data for instance).

Cédric Augonnet 15 yıl önce
ebeveyn
işleme
6c24cd5dc7
1 değiştirilmiş dosya ile 10 ekleme ve 7 silme
  1. 10 7
      src/datawizard/data_request.c

+ 10 - 7
src/datawizard/data_request.c

@@ -253,6 +253,16 @@ static void starpu_handle_data_request_completion(starpu_data_request_t r)
 
 	/* In case there are one or multiple callbacks, we execute them now. */
 	struct callback_list *callbacks = r->callbacks;
+	
+	_starpu_spin_unlock(&r->lock);
+
+	if (do_delete)
+		starpu_data_request_destroy(r);
+
+	_starpu_spin_unlock(&handle->header_lock);
+
+	/* We do the callback once the lock is released so that they can do
+	 * blocking operations with the handle (eg. release it) */
 	while (callbacks)
 	{
 		callbacks->callback_func(callbacks->callback_arg);
@@ -261,13 +271,6 @@ static void starpu_handle_data_request_completion(starpu_data_request_t r)
 		free(callbacks);
 		callbacks = next;
 	}
-
-	_starpu_spin_unlock(&r->lock);
-
-	if (do_delete)
-		starpu_data_request_destroy(r);
-
-	_starpu_spin_unlock(&handle->header_lock);
 }
 
 /* TODO : accounting to see how much time was spent working for other people ... */