From 0e91a8c41973d1d1b5e77b35e3db7b9417bbd5a5 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Wed, 27 Dec 2017 09:18:08 +0100 Subject: [PATCH] Drift multipoles atomically in cell_unskip(). --- src/cell.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cell.c b/src/cell.c index 9aa2e80636..92d1ee9a1c 100644 --- a/src/cell.c +++ b/src/cell.c @@ -1814,8 +1814,15 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj, if (!cell_is_active_gravity(ci, e) && !cell_is_active_gravity(cj, e)) return; + /* Atomically drift the multipole in ci */ + lock_lock(&ci->mlock); if (ci->ti_old_multipole < e->ti_current) cell_drift_multipole(ci, e); + if (lock_unlock(&ci->mlock) != 0) error("Impossible to unlock m-pole"); + + /* Atomically drift the multipole in cj */ + lock_lock(&cj->mlock); if (cj->ti_old_multipole < e->ti_current) cell_drift_multipole(cj, e); + if (lock_unlock(&cj->mlock) != 0) error("Impossible to unlock m-pole"); /* Recover the multipole information */ struct gravity_tensors *const multi_i = ci->multipole; -- GitLab