Skip to content
Snippets Groups Projects
Commit 47ed85d1 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

properly destroy glocks as well.

parent 9dcdeb4a
No related branches found
No related tags found
1 merge request!291Space recycle
......@@ -330,8 +330,8 @@ void engine_redistribute(struct engine *e) {
r++;
}
}
message("%ld of %ld (%.2f%%) of particles moved", total - unmoved,
total, 100.0 * (double)(total - unmoved) / (double)total);
message("%ld of %ld (%.2f%%) of particles moved", total - unmoved, total,
100.0 * (double)(total - unmoved) / (double)total);
}
}
......
......@@ -434,8 +434,8 @@ void space_regrid(struct space *s, int verbose) {
// message( "rebuilding upper-level cells took %.3f %s." ,
// clocks_from_ticks(double)(getticks() - tic), clocks_getunit());
} /* re-build upper-level cells? */
else {/* Otherwise, just clean up the cells. */
} /* re-build upper-level cells? */
else { /* Otherwise, just clean up the cells. */
/* Free the old cells, if they were allocated. */
threadpool_map(&s->e->threadpool, space_rebuild_recycle_mapper,
......@@ -1630,7 +1630,8 @@ void space_split_mapper(void *map_data, int num_cells, void *extra_data) {
void space_recycle(struct space *s, struct cell *c) {
/* Clear the cell. */
if (lock_destroy(&c->lock) != 0) error("Failed to destroy spinlock.");
if (lock_destroy(&c->lock) != 0 || lock_destroy(&c->glock) != 0)
error("Failed to destroy spinlock.");
/* Clear this cell's sort arrays. */
if (c->sort != NULL) free(c->sort);
......@@ -1665,7 +1666,8 @@ void space_recycle_list(struct space *s, struct cell *list_begin,
/* Clean up the list of cells. */
for (struct cell *c = list_begin; c != NULL; c = c->next) {
/* Clear the cell. */
if (lock_destroy(&c->lock) != 0) error("Failed to destroy spinlock.");
if (lock_destroy(&c->lock) != 0 || lock_destroy(&c->glock) != 0)
error("Failed to destroy spinlock.");
/* Clear this cell's sort arrays. */
if (c->sort != NULL) free(c->sort);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment