[gnome-builder] pipeline: complete queued tasks before advancing pipeline
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] pipeline: complete queued tasks before advancing pipeline
- Date: Mon, 16 Oct 2017 21:58:07 +0000 (UTC)
commit 39f89bbf64a70543f8939b74f869ede80dc4b2ed
Author: Christian Hergert <chergert redhat com>
Date: Mon Oct 16 14:54:47 2017 -0700
pipeline: complete queued tasks before advancing pipeline
If we are advancing the pipeline past the requested phase of any
queued tasks, we want to complete those tasks before processing
the next item.
This improves the situation where the things like requesting
build flags are queued behind a real build, when the necessary
phase has already completed but was queued before the build
started or before it had advanced past the requested phase.
src/libide/buildsystem/ide-build-pipeline.c | 44 +++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/src/libide/buildsystem/ide-build-pipeline.c b/src/libide/buildsystem/ide-build-pipeline.c
index d66dc2c..c0f60eb 100644
--- a/src/libide/buildsystem/ide-build-pipeline.c
+++ b/src/libide/buildsystem/ide-build-pipeline.c
@@ -1289,6 +1289,47 @@ ide_build_pipeline_try_chain (IdeBuildPipeline *self,
}
static void
+complete_queued_before_phase (IdeBuildPipeline *self,
+ IdeBuildPhase phase)
+{
+ g_assert (IDE_IS_BUILD_PIPELINE (self));
+
+ phase = phase & IDE_BUILD_PHASE_MASK;
+
+ for (GList *iter = self->task_queue.head; iter; iter = iter->next)
+ {
+ GTask *task;
+ TaskData *task_data;
+
+again:
+ task = iter->data;
+ task_data = g_task_get_task_data (task);
+
+ g_assert (G_IS_TASK (task));
+ g_assert (task_data->task == task);
+
+ /*
+ * If this task has a phase that is less-than the phase given
+ * to us, we can complete the task immediately.
+ */
+ if (task_data->phase < phase)
+ {
+ GList *to_remove = iter;
+
+ iter = iter->next;
+ g_queue_delete_link (&self->task_queue, to_remove);
+ g_task_return_boolean (task, TRUE);
+ g_object_unref (task);
+
+ if (iter == NULL)
+ break;
+
+ goto again;
+ }
+ }
+}
+
+static void
ide_build_pipeline_tick_execute (IdeBuildPipeline *self,
GTask *task)
{
@@ -1336,6 +1377,9 @@ ide_build_pipeline_tick_execute (IdeBuildPipeline *self,
g_assert (entry->stage != NULL);
g_assert (IDE_IS_BUILD_STAGE (entry->stage));
+ /* Complete any tasks that are waiting for this to complete */
+ complete_queued_before_phase (self, entry->phase);
+
/* Ignore the stage if it is disabled */
if (ide_build_stage_get_disabled (entry->stage))
continue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]