1
1

Ensure to increase the refcount on MPI_*_get_errhandler(). See

lengthy comment in src/mpi/c/comm_get_errhandler.c for an explanation
why.

This commit was SVN r3566.
Этот коммит содержится в:
Jeff Squyres 2004-11-15 13:36:22 +00:00
родитель 2975acb081
Коммит aec66ec597
3 изменённых файлов: 29 добавлений и 6 удалений

Просмотреть файл

@ -37,9 +37,30 @@ int MPI_Comm_get_errhandler(MPI_Comm comm, MPI_Errhandler *errhandler)
}
}
/* Return the errhandler. Do not increase the refcount here; we
only refcount on communicators */
/* Return the errhandler. A quandry. Should we increase the
refcount here?
- Consider that if we *get* an errhandler, we don't have to free
it. It's just a handle that was returned to the user. If they
never free it (and we increased the refcount), then it'll never
be freed.
- However, if we *don't* increase it and the user *does* free it,
then this could cause the refcount to go to 0 prematurely, and
a communicator could be left with a stale error handler.
Add to the mix that MPI-1:196:8-11 says that MPI_ERRHANDLER_FREE
will only free the error handler when all the communicators using
it have been freed.
All in all, it seems like we should increase the refcount to be
safe here. We're still conformant -- error handlers won't be
freed until all the communicators (or other objects using them)
are freed *and* any outstanding handles returned by this function
(or its peers) are also freed.
*/
OBJ_RETAIN(comm->error_handler);
*errhandler = comm->error_handler;
/* All done */

Просмотреть файл

@ -37,9 +37,10 @@ int MPI_File_get_errhandler( MPI_File file, MPI_Errhandler *errhandler)
}
}
/* Return the errhandler. Do not increase the refcount here; we
only refcount on communicators */
/* Return the errhandler. See lengthy comment in
comm_get_errhandler.c about why we increment the refcount. */
OBJ_RETAIN(file->error_handler);
*errhandler = file->error_handler;
/* All done */

Просмотреть файл

@ -39,9 +39,10 @@ int MPI_Win_get_errhandler(MPI_Win win, MPI_Errhandler *errhandler)
}
}
/* Return the errhandler. Do not increase the refcount here; we
only refcount on communicators */
/* Return the errhandler. See lengthy comment in
comm_get_errhandler.c about why we increment the refcount. */
OBJ_RETAIN(win->error_handler);
*errhandler = win->error_handler;
/* All done */