drivers/serial: fix deadlock when executing rexec in a user task
CPU0 CPU1 task:nsh_main task:user_app rexecd nsh_consolemain system uart_read rexec --- got recv.lock poll --- uart_poll rpmsg_socket_poll rpmsg_socket_close wait recvsem get recv.lock poll_notify deadlock routine work the error accurs in CPU0 when waiting console input resolve: unlock recv.lock when waiting recvsem Signed-off-by: fangpeina <fangpeina@xiaomi.com>
This commit is contained in:
parent
10e7d8fe44
commit
11f06eb0f5
@ -1052,15 +1052,19 @@ static ssize_t uart_read(FAR struct file *filep,
|
||||
dev->minrecv = MIN(buflen - recvd, dev->minread - recvd);
|
||||
if (dev->timeout)
|
||||
{
|
||||
nxmutex_unlock(&dev->recv.lock);
|
||||
ret = nxsem_tickwait(&dev->recvsem,
|
||||
DSEC2TICK(dev->timeout));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
nxmutex_unlock(&dev->recv.lock);
|
||||
ret = nxsem_wait(&dev->recvsem);
|
||||
}
|
||||
|
||||
nxmutex_lock(&dev->recv.lock);
|
||||
|
||||
#ifdef CONFIG_SERIAL_TERMIOS
|
||||
dev->minrecv = dev->minread;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user