Skip to content

Commit d3fc3ac

Browse files
committed
sharedfp/sm: close the named semaphore
in case a named semaphore is used, it is necessary to close the semaphore to remove all sm segments. sem_unlink just removes the name references once all proceeses have closed the sem. Fixes issue: #4336 Signed-off-by: Edgar Gabriel <[email protected]>
1 parent 27eb401 commit d3fc3ac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm,
231231

232232
comm->c_coll->coll_barrier (comm, comm->c_coll->coll_barrier_module );
233233

234+
#if defined(HAVE_SEM_OPEN)
235+
sem_unlink ( sm_data->sem_name);
236+
#endif
237+
234238
return err;
235239
}
236240

@@ -263,7 +267,7 @@ int mca_sharedfp_sm_file_close (mca_io_ompio_file_t *fh)
263267
if (file_data->sm_offset_ptr) {
264268
/* destroy semaphore */
265269
#if defined(HAVE_SEM_OPEN)
266-
sem_unlink (file_data->sem_name);
270+
sem_close ( file_data->mutex);
267271
free (file_data->sem_name);
268272
#elif defined(HAVE_SEM_INIT)
269273
sem_destroy(&file_data->sm_offset_ptr->mutex);

0 commit comments

Comments
 (0)