From 7544e7ca1164355eb3ae893058807c28b71bdb8a Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Wed, 26 Apr 2017 22:41:55 +0100
Subject: [PATCH] Make sure the self tasks get a drift even when we don't need
 to split them at the top level.

---
 src/scheduler.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/scheduler.c b/src/scheduler.c
index d97fd65fe4..cd7c61525f 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -173,6 +173,13 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) {
           /* convert to a self-subtask. */
           t->type = task_type_sub_self;
 
+          /* Make sure we have a drift task */
+          lock_lock(&ci->lock);
+          if (ci->drift == NULL)
+            ci->drift = scheduler_addtask(s, task_type_drift, task_subtype_none,
+                                          0, 0, ci, NULL, 0);
+          lock_unlock_blind(&ci->lock);
+
           /* Depend on local sorts on this cell. */
           if (ci->sorts != NULL) scheduler_addunlock(s, ci->sorts, t);
 
-- 
GitLab