1
1

Merge pull request #4757 from ggouaillardet/topic/iof_hnp

iof: do not release a sink before all read data is written.
Этот коммит содержится в:
Ralph Castain 2018-01-26 14:43:01 -08:00 коммит произвёл GitHub
родитель 5190f4e4ec e284a3e98b
Коммит f3fbc1172d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 16 добавлений и 3 удалений

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

@ -105,6 +105,7 @@ typedef struct {
orte_iof_write_event_t *wev;
bool xoff;
bool exclusive;
bool closed;
} orte_iof_sink_t;
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_iof_sink_t);

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

@ -241,6 +241,7 @@ static void orte_iof_base_sink_construct(orte_iof_sink_t* ptr)
ptr->wev = OBJ_NEW(orte_iof_write_event_t);
ptr->xoff = false;
ptr->exclusive = false;
ptr->closed = false;
}
static void orte_iof_base_sink_destruct(orte_iof_sink_t* ptr)
{

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

@ -13,7 +13,7 @@
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014-2017 Research Organization for Information Science
* Copyright (c) 2014-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2017 Mellanox Technologies. All rights reserved.
@ -629,6 +629,10 @@ static void stdin_write_handler(int fd, short event, void *cbdata)
ORTE_IOF_READ_ACTIVATE(mca_iof_hnp_component.stdinev);
}
}
if (sink->closed && 0 == opal_list_get_size(&wev->outputs)) {
/* the sink has already been closed and everything was written, time to release it */
OBJ_RELEASE(sink);
}
return;
finish:
OBJ_RELEASE(wev);

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

@ -14,6 +14,8 @@
* reserved.
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
* Copyright (c) 2017 Mellanox Technologies. All rights reserved.
* Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -204,8 +206,13 @@ void orte_iof_hnp_read_local_handler(int fd, short event, void *cbdata)
/* if num_bytes was zero, or we read the last piece of the file, then we need to terminate the event */
if (0 == numbytes) {
/* this will also close our stdin file descriptor */
OBJ_RELEASE(proct->stdinev);
if (0 != opal_list_get_size(&proct->stdinev->wev->outputs)) {
/* some stuff has yet to be written, so delay the release of proct->stdinev */
proct->stdinev->closed = true;
} else {
/* this will also close our stdin file descriptor */
OBJ_RELEASE(proct->stdinev);
}
} else {
/* if we are looking at a tty, then we just go ahead and restart the
* read event assuming we are not backgrounded