Browse Source

port r11310 from 1.1: Fix looking through a list while removing elements

Samuel Thibault 12 years ago
parent
commit
970c99c558
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/sched_policies/eager_central_priority_policy.c

+ 3 - 2
src/sched_policies/eager_central_priority_policy.c

@@ -151,7 +151,7 @@ static int _starpu_priority_push_task(struct starpu_task *task)
 
 static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
 {
-	struct starpu_task *chosen_task = NULL, *task;
+	struct starpu_task *chosen_task = NULL, *task, *nexttask;
 	unsigned workerid = starpu_worker_get_id();
 	int skipped = 0;
 
@@ -183,9 +183,10 @@ static struct starpu_task *_starpu_priority_pop_task(unsigned sched_ctx_id)
 		{
 			for (task  = starpu_task_list_begin(&taskq->taskq[priolevel]);
 			     task != starpu_task_list_end(&taskq->taskq[priolevel]);
-			     task  = starpu_task_list_next(task)) 
+			     task  = nexttask) 
 			{
 				unsigned nimpl;
+				nexttask = starpu_task_list_next(task);
 				for (nimpl = 0; nimpl < STARPU_MAXIMPLEMENTATIONS; nimpl++)
 				{
 					if (starpu_worker_can_execute_task(workerid, task, nimpl))