From ed5e770bd5949b4f36cd183a76ff4045dfb2c4d2 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Wed, 26 Mar 2008 19:49:34 +0000
Subject: [PATCH] change the pthread locking to eliminate a race condition that
 appears in AIX

---
 src/api/step_launch.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/api/step_launch.c b/src/api/step_launch.c
index 81204a7fcc4..86e99957434 100644
--- a/src/api/step_launch.c
+++ b/src/api/step_launch.c
@@ -425,7 +425,9 @@ void slurm_step_launch_wait_finish(slurm_step_ctx_t *ctx)
 
 	/* Then shutdown the message handler thread */
 	eio_signal_shutdown(sls->msg_handle);
+	pthread_mutex_unlock(&sls->lock);
 	pthread_join(sls->msg_thread, NULL);
+	pthread_mutex_lock(&sls->lock);
 	eio_handle_destroy(sls->msg_handle);
 
 	/* Then wait for the IO thread to finish */
@@ -435,7 +437,6 @@ void slurm_step_launch_wait_finish(slurm_step_ctx_t *ctx)
 	}
 
 	mpi_hook_client_fini(sls->mpi_state);
-
 	pthread_mutex_unlock(&sls->lock);
 }
 
-- 
GitLab