1
1

grequestx: retain request object until it is removed from the list

Signed-off-by: Joseph Schuchart <schuchart@hlrs.de>
Этот коммит содержится в:
Joseph Schuchart 2020-03-20 14:52:42 +01:00
родитель b3f0bc5490
Коммит 4a39a34bab

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

@ -47,6 +47,7 @@ static int grequestx_progress(void) {
OPAL_THREAD_LOCK(&lock); OPAL_THREAD_LOCK(&lock);
if (REQUEST_COMPLETE(&request->greq_base)) { if (REQUEST_COMPLETE(&request->greq_base)) {
opal_list_remove_item(&requests, &request->greq_base.super.super); opal_list_remove_item(&requests, &request->greq_base.super.super);
OBJ_RELEASE(request);
completed++; completed++;
} }
} }
@ -73,6 +74,11 @@ int ompi_grequestx_start(
} }
((ompi_grequest_t *)*request)->greq_poll.c_poll = gpoll_fn; ((ompi_grequest_t *)*request)->greq_poll.c_poll = gpoll_fn;
/* prevent the request from being destroyed upon completion,
* we first have to remove it from the list of active requests
*/
OBJ_RETAIN(((ompi_grequest_t *)*request));
if (!requests_initialized) { if (!requests_initialized) {
OBJ_CONSTRUCT(&requests, opal_list_t); OBJ_CONSTRUCT(&requests, opal_list_t);
OBJ_CONSTRUCT(&lock, opal_mutex_t); OBJ_CONSTRUCT(&lock, opal_mutex_t);