Skip to content

Commit

Permalink
Better pthread management
Browse files Browse the repository at this point in the history
  • Loading branch information
houjun committed Aug 25, 2024
1 parent 2d0eb24 commit 00a6b68
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/api/pdc_client_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,13 @@ PDC_Client_finalize()
if (pdc_server_info_g != NULL)
free(pdc_server_info_g);

// Join the thread of trasfer start all
if (hg_progress_shutdown_flag_g == 0) {
hg_progress_shutdown_flag_g = 1;
pthread_join(hg_progress_tid_g, NULL);
hg_progress_shutdown_flag_g = -1;
}

#ifndef ENABLE_MPI
for (i = 0; i < pdc_server_num_g; i++) {
printf(" Server%3d, %d\n", i, debug_server_id_count[i]);
Expand Down Expand Up @@ -3422,9 +3429,11 @@ PDC_Client_transfer_request_wait_all(int n_objs, pdcid_t *transfer_request_id, u

FUNC_ENTER(NULL);
// Join the thread of trasfer start all
hg_progress_shutdown_flag_g = 1;
pthread_join(hg_progress_tid_g, NULL);
hg_progress_shutdown_flag_g = -1;
if (hg_progress_shutdown_flag_g == 0) {
hg_progress_shutdown_flag_g = 1;
pthread_join(hg_progress_tid_g, NULL);
hg_progress_shutdown_flag_g = -1;
}

#ifdef PDC_TIMING
double start = MPI_Wtime(), end;
Expand Down

0 comments on commit 00a6b68

Please sign in to comment.