提交 95b5c80d 编写于 作者: G gaohuatao

fix shim io copy lost msgs problem occasionally

Signed-off-by: Ngaohuatao <gaohuatao@huawei.com>
上级 5b467d36
...@@ -243,7 +243,7 @@ static void* task_io_copy(void *data) ...@@ -243,7 +243,7 @@ static void* task_io_copy(void *data)
for (;;) { for (;;) {
memset(buf, 0, DEFAULT_IO_COPY_BUF); memset(buf, 0, DEFAULT_IO_COPY_BUF);
sem_wait(&(io_thd->sem_thd)); sem_wait(&(io_thd->sem_thd));
if (io_thd->shutdown) { if (io_thd->is_stdin && io_thd->shutdown) {
break; break;
} }
...@@ -272,6 +272,10 @@ static void* task_io_copy(void *data) ...@@ -272,6 +272,10 @@ static void* task_io_copy(void *data)
} }
} }
} }
if (io_thd->shutdown) {
break;
}
} }
struct epoll_event ev; struct epoll_event ev;
ev.events = EPOLLIN; ev.events = EPOLLIN;
...@@ -328,6 +332,7 @@ static int process_io_start(process_t *p, int std_id) ...@@ -328,6 +332,7 @@ static int process_io_start(process_t *p, int std_id)
io_thd->epfd = p->io_loop_fd; io_thd->epfd = p->io_loop_fd;
io_thd->ioc = ioc; io_thd->ioc = ioc;
io_thd->shutdown = false; io_thd->shutdown = false;
io_thd->is_stdin = std_id == stdid_in ? true : false;
io_thd->terminal = std_id != stdid_in ? p->terminal : NULL; io_thd->terminal = std_id != stdid_in ? p->terminal : NULL;
p->io_threads[std_id] = io_thd; p->io_threads[std_id] = io_thd;
......
...@@ -58,6 +58,7 @@ typedef struct { ...@@ -58,6 +58,7 @@ typedef struct {
sem_t sem_thd; sem_t sem_thd;
io_copy_t *ioc; io_copy_t *ioc;
bool shutdown; bool shutdown;
bool is_stdin;
log_terminal *terminal; log_terminal *terminal;
} io_thread_t; } io_thread_t;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册