This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 99584588fc08b5d35bc266296fa0688797bab31c Author: wangjinjing1 <[email protected]> AuthorDate: Thu Feb 27 10:00:11 2025 +0800 net/can: modify net_unlock location before txnotify for can_sendmsg_buffered.c Release the lock early to reduce the number of thread switches. Signed-off-by: wangjinjing1 <[email protected]> --- net/can/can_sendmsg_buffered.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/can/can_sendmsg_buffered.c b/net/can/can_sendmsg_buffered.c index 98389388ef7..0d45aea9b3c 100644 --- a/net/can/can_sendmsg_buffered.c +++ b/net/can/can_sendmsg_buffered.c @@ -387,12 +387,20 @@ ssize_t can_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg, conn->sndcb->priv = (FAR void *)conn; conn->sndcb->event = psock_send_eventhandler; + /* unlock */ + + net_unlock(); + /* Notify the device driver that new TX data is available. */ netdev_txnotify_dev(dev); } + else + { + /* unlock */ - net_unlock(); + net_unlock(); + } return msg->msg_iov->iov_len;
