Преглед на файлове

Add a "cleanup" flag in the task structure (which is activated by default). If
set, this flags tells StarPU to free the task structure once the task is done.

Cédric Augonnet преди 17 години
родител
ревизия
56765687d6
променени са 2 файла, в които са добавени 12 реда и са изтрити 0 реда
  1. 3 0
      include/starpu-task.h
  2. 9 0
      src/core/jobs.c

+ 3 - 0
include/starpu-task.h

@@ -88,6 +88,9 @@ struct starpu_task {
 	int priority; /* MAX_PRIO = most important 
         		: MIN_PRIO = least important */
 
+	/* should the task be automatically liberated once executed ? */
+	int cleanup;
+
 	/* this is private to StarPU, do not modify */
 	void *starpu_private;
 };

+ 9 - 0
src/core/jobs.c

@@ -76,6 +76,9 @@ struct starpu_task * __attribute__((malloc)) starpu_task_create(void)
 
 	task->priority = DEFAULT_PRIO;
 
+	/* by default, we let StarPU free the task structure */
+	task->cleanup = 1;
+
 	return task;
 }
 
@@ -117,6 +120,9 @@ void handle_job_termination(job_t j)
 	}
 	else
 	{
+		if (j->task->cleanup)
+			free(j->task);
+
 		job_delete(j);
 	}
 
@@ -136,6 +142,9 @@ static void block_sync_task(job_t j)
 
 	/* as this is a synchronous task, the liberation of the job
 	   structure was deferred */
+	if (j->task->cleanup)
+		free(j->task);
+
 	job_delete(j);
 }