Skip to content
Snippets Groups Projects
Commit 5bd48e07 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Also apply the same procedure for the black holes swallowing.

parent 431c0d7f
No related branches found
No related tags found
1 merge request!858Lock before removing particles
......@@ -3822,10 +3822,15 @@ void runner_do_swallow(struct runner *r, struct cell *c, int timer) {
lock_lock(&e->s->lock);
/* Finally, remove the gas particle from the system */
struct gpart *gp = p->gpart;
cell_remove_part(e, c, p, xp);
cell_remove_gpart(e, c, gp);
/* Re-check that the particle has not been removed
* by another thread before we do the deed. */
if (!part_is_inhibited(p, e)) {
/* Finally, remove the gas particle from the system */
struct gpart *gp = p->gpart;
cell_remove_part(e, c, p, xp);
cell_remove_gpart(e, c, gp);
}
if (lock_unlock(&e->s->lock) != 0)
error("Failed to unlock the space!");
......@@ -3860,10 +3865,15 @@ void runner_do_swallow(struct runner *r, struct cell *c, int timer) {
lock_lock(&e->s->lock);
/* Finally, remove the gas particle from the system */
struct gpart *gp = p->gpart;
cell_remove_part(e, c, p, xp);
cell_remove_gpart(e, c, gp);
/* Re-check that the particle has not been removed
* by another thread before we do the deed. */
if (!part_is_inhibited(p, e)) {
/* Finally, remove the gas particle from the system */
struct gpart *gp = p->gpart;
cell_remove_part(e, c, p, xp);
cell_remove_gpart(e, c, gp);
}
if (lock_unlock(&e->s->lock) != 0)
error("Failed to unlock the space!");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment