Commit f0278cc1 authored by Shane Snyder's avatar Shane Snyder
Browse files

bug fix to unregister modules when shutting down

parent 2e912409
...@@ -276,6 +276,8 @@ static void bgq_get_output_data( ...@@ -276,6 +276,8 @@ static void bgq_get_output_data(
/* Shutdown the BGQ module by freeing up all data structures. */ /* Shutdown the BGQ module by freeing up all data structures. */
static void bgq_shutdown() static void bgq_shutdown()
{ {
darshan_core_unregister_module(DARSHAN_BGQ_MOD);
if (bgq_runtime) if (bgq_runtime)
{ {
free(bgq_runtime); free(bgq_runtime);
......
...@@ -1656,7 +1656,6 @@ void darshan_core_register_module( ...@@ -1656,7 +1656,6 @@ void darshan_core_register_module(
return; return;
} }
/* TODO: test */
void darshan_core_unregister_module( void darshan_core_unregister_module(
darshan_module_id mod_id) darshan_module_id mod_id)
{ {
...@@ -1667,6 +1666,8 @@ void darshan_core_unregister_module( ...@@ -1667,6 +1666,8 @@ void darshan_core_unregister_module(
DARSHAN_CORE_LOCK(); DARSHAN_CORE_LOCK();
if(darshan_core->mod_array[mod_id])
{
/* iterate all records and disassociate this module from them */ /* iterate all records and disassociate this module from them */
HASH_ITER(hlink, darshan_core->rec_hash, ref, tmp) HASH_ITER(hlink, darshan_core->rec_hash, ref, tmp)
{ {
...@@ -1675,7 +1676,7 @@ void darshan_core_unregister_module( ...@@ -1675,7 +1676,7 @@ void darshan_core_unregister_module(
free(darshan_core->mod_array[mod_id]); free(darshan_core->mod_array[mod_id]);
darshan_core->mod_array[mod_id] = NULL; darshan_core->mod_array[mod_id] = NULL;
}
DARSHAN_CORE_UNLOCK(); DARSHAN_CORE_UNLOCK();
return; return;
......
...@@ -564,6 +564,8 @@ static void hdf5_shutdown() ...@@ -564,6 +564,8 @@ static void hdf5_shutdown()
assert(hdf5_runtime); assert(hdf5_runtime);
darshan_core_unregister_module(DARSHAN_HDF5_MOD);
HASH_ITER(hlink, hdf5_runtime->hid_hash, ref, tmp) HASH_ITER(hlink, hdf5_runtime->hid_hash, ref, tmp)
{ {
HASH_DELETE(hlink, hdf5_runtime->hid_hash, ref); HASH_DELETE(hlink, hdf5_runtime->hid_hash, ref);
......
...@@ -1514,6 +1514,8 @@ static void mpiio_shutdown() ...@@ -1514,6 +1514,8 @@ static void mpiio_shutdown()
assert(mpiio_runtime); assert(mpiio_runtime);
darshan_core_unregister_module(DARSHAN_MPIIO_MOD);
HASH_ITER(hlink, mpiio_runtime->fh_hash, ref, tmp) HASH_ITER(hlink, mpiio_runtime->fh_hash, ref, tmp)
{ {
HASH_DELETE(hlink, mpiio_runtime->fh_hash, ref); HASH_DELETE(hlink, mpiio_runtime->fh_hash, ref);
......
...@@ -374,6 +374,8 @@ static void null_shutdown() ...@@ -374,6 +374,8 @@ static void null_shutdown()
{ {
assert(null_runtime); assert(null_runtime);
darshan_core_unregister_module(DARSHAN_NULL_MOD);
HASH_CLEAR(hlink, null_runtime->record_hash); /* these hash entries are freed all at once below */ HASH_CLEAR(hlink, null_runtime->record_hash); /* these hash entries are freed all at once below */
free(null_runtime->runtime_record_array); free(null_runtime->runtime_record_array);
......
...@@ -576,6 +576,8 @@ static void pnetcdf_shutdown() ...@@ -576,6 +576,8 @@ static void pnetcdf_shutdown()
assert(pnetcdf_runtime); assert(pnetcdf_runtime);
darshan_core_unregister_module(DARSHAN_PNETCDF_MOD);
HASH_ITER(hlink, pnetcdf_runtime->ncid_hash, ref, tmp) HASH_ITER(hlink, pnetcdf_runtime->ncid_hash, ref, tmp)
{ {
HASH_DELETE(hlink, pnetcdf_runtime->ncid_hash, ref); HASH_DELETE(hlink, pnetcdf_runtime->ncid_hash, ref);
......
...@@ -2249,6 +2249,8 @@ static void posix_shutdown() ...@@ -2249,6 +2249,8 @@ static void posix_shutdown()
assert(posix_runtime); assert(posix_runtime);
darshan_core_unregister_module(DARSHAN_POSIX_MOD);
HASH_ITER(hlink, posix_runtime->fd_hash, ref, tmp) HASH_ITER(hlink, posix_runtime->fd_hash, ref, tmp)
{ {
HASH_DELETE(hlink, posix_runtime->fd_hash, ref); HASH_DELETE(hlink, posix_runtime->fd_hash, ref);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment