forked from enlightenment/terminology
term pty fd - properly shut down without a 100% cpu hang
i've noticed that the exe cb tries to drain the pty fd but reads return -1 with EAGAIN so terminology just spins forever in cpu trying to drain a buffer that does not drain, so make a special case on exe exit - drain until there just is nothing else to read then give up. @fix
This commit is contained in:
parent
45539d433c
commit
60d1c6d05c
|
@ -157,9 +157,8 @@ _pty_size(Termpty *ty)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_cb_fd_read(void *data, Ecore_Fd_Handler *fd_handler)
|
||||
_fd_read_do(Termpty *ty, Ecore_Fd_Handler *fd_handler, Eina_Bool false_on_empty)
|
||||
{
|
||||
Termpty *ty = data;
|
||||
char buf[4097];
|
||||
Eina_Unicode codepoint[4097];
|
||||
int len, i, j, k, reads;
|
||||
|
@ -286,10 +285,16 @@ _cb_fd_read(void *data, Ecore_Fd_Handler *fd_handler)
|
|||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((false_on_empty) && (len <= 0)) return ECORE_CALLBACK_CANCEL;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_cb_fd_read(void *data, Ecore_Fd_Handler *fd_handler)
|
||||
{
|
||||
return _fd_read_do(data, fd_handler, EINA_FALSE);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_cb_exe_exit(void *data,
|
||||
int _type EINA_UNUSED,
|
||||
|
@ -311,7 +316,7 @@ _cb_exe_exit(void *data,
|
|||
res = ECORE_CALLBACK_PASS_ON;
|
||||
while (ty->hand_fd && res != ECORE_CALLBACK_CANCEL)
|
||||
{
|
||||
res = _cb_fd_read(ty, ty->hand_fd);
|
||||
res = _fd_read_do(ty, ty->hand_fd, EINA_TRUE);
|
||||
}
|
||||
|
||||
if (ty->hand_fd) ecore_main_fd_handler_del(ty->hand_fd);
|
||||
|
|
Loading…
Reference in New Issue