From 06ff1631d24fe45a31aabe429e73973c34437536 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Mon, 8 Jul 2019 17:40:04 +0200
Subject: [PATCH] Put the star resort task at the hydro-super level not the
 overall super level.

---
 src/engine_maketasks.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/engine_maketasks.c b/src/engine_maketasks.c
index 49cccb21ad..8e095acde2 100644
--- a/src/engine_maketasks.c
+++ b/src/engine_maketasks.c
@@ -807,11 +807,6 @@ void engine_make_hierarchical_tasks_common(struct engine *e, struct cell *c) {
       if (with_star_formation && c->hydro.count > 0) {
         scheduler_addunlock(s, c->kick2, c->top->hydro.star_formation);
         scheduler_addunlock(s, c->top->hydro.star_formation, c->timestep);
-
-        c->hydro.stars_resort = scheduler_addtask(
-            s, task_type_stars_resort, task_subtype_none, 0, 0, c, NULL);
-        scheduler_addunlock(s, c->top->hydro.star_formation,
-                            c->hydro.stars_resort);
       }
 
       /* Time-step limiting */
@@ -1080,8 +1075,13 @@ void engine_make_hierarchical_tasks_hydro(struct engine *e, struct cell *c) {
         scheduler_addunlock(s, c->stars.stars_out, c->super->timestep);
 
         if (with_star_formation && c->hydro.count > 0) {
-          scheduler_addunlock(s, c->super->hydro.stars_resort,
-                              c->stars.stars_in);
+
+          c->hydro.stars_resort = scheduler_addtask(
+              s, task_type_stars_resort, task_subtype_none, 0, 0, c, NULL);
+          scheduler_addunlock(s, c->top->hydro.star_formation,
+                              c->hydro.stars_resort);
+
+          scheduler_addunlock(s, c->hydro.stars_resort, c->stars.stars_in);
         }
       }
 
-- 
GitLab