Explorar el Código

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 hace 15 años
padre
commit
6c24cd5dc7
Se han modificado 1 ficheros con 10 adiciones y 7 borrados
  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 ... */