代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 701e207702945705c0f8a94babf09d1fe8c2b3da Mon Sep 17 00:00:00 2001
From: wu-changsheng <wuchangsheng2@huawei.com>
Date: Mon, 31 Oct 2022 17:37:08 +0800
Subject: [PATCH 4/7] add usleep when write_ring is busy
---
src/lstack/core/lstack_lwip.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/lstack/core/lstack_lwip.c b/src/lstack/core/lstack_lwip.c
index 00afc75..3a1eb81 100644
--- a/src/lstack/core/lstack_lwip.c
+++ b/src/lstack/core/lstack_lwip.c
@@ -282,16 +282,11 @@ ssize_t write_stack_data(struct lwip_sock *sock, const void *buf, size_t len)
GAZELLE_RETURN(ENOTCONN);
}
- uint32_t free_count = gazelle_ring_readable_count(sock->send_ring);
- if (free_count == 0) {
- return 0;
- }
-
struct pbuf *pbuf = NULL;
ssize_t send_len = 0;
uint32_t send_pkt = 0;
- while (send_len < len && send_pkt < free_count) {
+ while (send_len < len) {
if (sock->send_lastdata) {
pbuf = sock->send_lastdata;
} else {
@@ -322,6 +317,10 @@ ssize_t write_stack_data(struct lwip_sock *sock, const void *buf, size_t len)
sock->wakeup->stat.app_write_cnt += send_pkt;
}
+ if (send_len == 0) {
+ /* 100: give up cpu to other threads, when send_ring is full */
+ usleep(100);
+ }
return send_len;
}
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。