Skip to content

Commit

Permalink
Pass user_data argument to free_cb_function registered with MPI_T_eve…
Browse files Browse the repository at this point in the history
…nt_handle_free function.
  • Loading branch information
Kingshuk Haldar committed May 21, 2024
1 parent 66b29d5 commit 0827799
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion ompi/mpi/tool/event_handle_free.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018-2019 Triad National Security, LLC. All rights
* reserved.
* Copyright (c) 2024 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -40,7 +42,7 @@ int MPI_T_event_handle_free (MPI_T_event_registration event_registration,
if (MPI_T_EVENT_REGISTRATION_NULL == event_registration) {
ret = MPI_T_ERR_INVALID_HANDLE;
} else {
mca_base_event_registration_free (event_registration,
mca_base_event_registration_free (event_registration, user_data,
(mca_base_event_registration_free_cb_fn_t) free_cb_function);
}

Expand Down
7 changes: 5 additions & 2 deletions opal/mca/base/mca_base_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018-2019 Triad National Security, LLC. All rights
* reserved.
* Copyright (c) 2024 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -416,8 +418,9 @@ int mca_base_event_callback_get_info (mca_base_event_registration_t *registratio
return OPAL_SUCCESS;
}

void mca_base_event_registration_free (mca_base_event_registration_t *registration, mca_base_event_registration_free_cb_fn_t cbfn)
void mca_base_event_registration_free (mca_base_event_registration_t *registration, void *user_data, mca_base_event_registration_free_cb_fn_t cbfn)
{
registration->user_data[MCA_BASE_CB_REQUIRE_NONE] = user_data;
registration->free_cb = cbfn;
OBJ_RELEASE(registration);
}
Expand Down Expand Up @@ -577,7 +580,7 @@ static void mca_base_event_registration_destructor (mca_base_event_registration_
}

if (registration->free_cb) {
registration->free_cb (registration, MCA_BASE_CB_REQUIRE_NONE, registration->user_data);
registration->free_cb (registration, MCA_BASE_CB_REQUIRE_NONE, registration->user_data[MCA_BASE_CB_REQUIRE_NONE]);
}
}

Expand Down
4 changes: 3 additions & 1 deletion opal/mca/base/mca_base_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* reserved.
* Copyright (c) 2018-2019 Triad National Security, LLC. All rights
* reserved.
* Copyright (c) 2024 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
*
* Additional copyrights may follow
*
Expand Down Expand Up @@ -198,7 +200,7 @@ OPAL_DECLSPEC int mca_base_event_registration_alloc (mca_base_event_t *event, vo
OPAL_DECLSPEC int mca_base_event_register_callback (mca_base_event_registration_t *registration, mca_base_cb_safety_t cb_safety,
opal_info_t *info, void *user_data, mca_base_event_cb_fn_t event_cbfn);

OPAL_DECLSPEC void mca_base_event_registration_free (mca_base_event_registration_t *registration, mca_base_event_registration_free_cb_fn_t cbfn);
OPAL_DECLSPEC void mca_base_event_registration_free (mca_base_event_registration_t *registration, void *user_data, mca_base_event_registration_free_cb_fn_t cbfn);

OPAL_DECLSPEC void mca_base_event_registration_set_dropped_handler (mca_base_event_registration_t *registration, mca_base_event_dropped_cb_fn_t cbfn);

Expand Down

0 comments on commit 0827799

Please sign in to comment.