浏览代码

We cannot put a task into a bundle after its submission.

Cédric Augonnet 14 年之前
父节点
当前提交
904fd13997
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/core/task_bundle.c

+ 8 - 0
src/core/task_bundle.c

@@ -68,6 +68,14 @@ int starpu_task_bundle_insert(struct starpu_task_bundle *bundle, struct starpu_t
 		return -EPERM;
 		return -EPERM;
 	}
 	}
 
 
+	if (task->status != STARPU_TASK_INVALID)
+	{
+		/* the task has already been submitted, it's too late to put it
+		 * into a bundle now. */
+		PTHREAD_MUTEX_UNLOCK(&bundle->mutex);
+		return -EINVAL;
+	}
+
 	/* Insert a task at the end of the bundle */
 	/* Insert a task at the end of the bundle */
 	struct starpu_task_bundle_entry *entry;
 	struct starpu_task_bundle_entry *entry;
 	entry = malloc(sizeof(struct starpu_task_bundle_entry));
 	entry = malloc(sizeof(struct starpu_task_bundle_entry));