diff --git a/src/utils/ctl/cart_ctl.c b/src/utils/ctl/cart_ctl.c index b251f5e9d79..3bdf65b2bbb 100644 --- a/src/utils/ctl/cart_ctl.c +++ b/src/utils/ctl/cart_ctl.c @@ -760,6 +760,13 @@ ctl_init() rc); } + /* Stop the progress thread before destroying the group */ + crtu_progress_stop(); + + rc = pthread_join(ctl_gdata.cg_tid, NULL); + if (rc != 0) + error_warn("Failed to join the threads; rc=%d\n", rc); + d_rank_list_free(rank_list); if (ctl_gdata.cg_save_cfg) { @@ -772,12 +779,6 @@ ctl_init() error_warn("Failed to destroy the view; rc=%d\n", rc); } - crtu_progress_stop(); - - rc = pthread_join(ctl_gdata.cg_tid, NULL); - if (rc != 0) - error_warn("Failed to join the threads; rc=%d\n", rc); - rc = sem_destroy(&ctl_gdata.cg_num_reply); if (rc != 0) error_warn("Failed to destroy a semaphore; rc=%d\n", rc);