Skip to content

Commit 97e683d

Browse files
committed
Treat a NULL name as indicating "stop all threads"
When passed a NULL name, stop all progress threads Signed-off-by: Ralph Castain <[email protected]>
1 parent b600e77 commit 97e683d

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

src/runtime/prte_finalize.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "src/mca/ess/ess.h"
4444
#include "src/runtime/prte_globals.h"
4545
#include "src/runtime/prte_locks.h"
46+
#include "src/runtime/prte_progress_threads.h"
4647
#include "src/runtime/runtime.h"
4748
#include "src/util/name_fns.h"
4849
#include "src/util/proc_info.h"
@@ -79,6 +80,9 @@ int prte_finalize(void)
7980
/* flag that we are finalizing */
8081
prte_finalizing = true;
8182

83+
// stop ALL prte progress threads
84+
prte_progress_thread_pause(NULL);
85+
8286
// we always must cleanup the session directory tree
8387
prte_job_session_dir_finalize(NULL);
8488

src/runtime/prte_progress_threads.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
33
* Copyright (c) 2015-2020 Cisco Systems, Inc. All rights reserved
4-
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
4+
* Copyright (c) 2021-2026 Nanook Consulting All rights reserved.
55
* $COPYRIGHT$
66
*
77
* Additional copyrights may follow
@@ -378,15 +378,7 @@ int prte_progress_thread_finalize(const char *name)
378378
PMIX_LIST_FOREACH(trk, &tracking, prte_progress_tracker_t)
379379
{
380380
if (0 == strcmp(name, trk->name)) {
381-
/* decrement the refcount */
382-
--trk->refcount;
383-
384-
/* If the refcount is still above 0, we're done here */
385-
if (trk->refcount > 0) {
386-
return PRTE_SUCCESS;
387-
}
388-
389-
/* If the progress thread is active, stop it */
381+
/* If the progress thread is active, stop it */
390382
if (trk->ev_active) {
391383
stop_progress_engine(trk);
392384
}
@@ -412,23 +404,20 @@ int prte_progress_thread_pause(const char *name)
412404
return PRTE_ERR_NOT_FOUND;
413405
}
414406

415-
if (NULL == name) {
416-
name = shared_thread_name;
417-
}
418-
419407
/* find the specified engine */
420408
PMIX_LIST_FOREACH(trk, &tracking, prte_progress_tracker_t)
421409
{
422-
if (0 == strcmp(name, trk->name)) {
410+
if (NULL == name || 0 == strcmp(name, trk->name)) {
423411
if (trk->ev_active) {
424412
stop_progress_engine(trk);
425413
}
426-
427-
return PRTE_SUCCESS;
414+
if (NULL != name) {
415+
break;
416+
}
428417
}
429418
}
430419

431-
return PRTE_ERR_NOT_FOUND;
420+
return PRTE_SUCCESS;
432421
}
433422

434423
#if PRTE_HAVE_LIBEV

0 commit comments

Comments
 (0)