blob: 9d70f921a540edea2c83eb51804d61cddf417dde (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
From 384cf7870c155d41f742b1928a4cb1b56aa46c94 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Tue, 6 Feb 2024 20:05:05 +0800
Subject: [PATCH 12/43] sleep some time in ServiceWorkThread to prevent the CPU
from being occupied all the time
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
src/daemon/entry/cri/streams/websocket/ws_server.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/daemon/entry/cri/streams/websocket/ws_server.cc b/src/daemon/entry/cri/streams/websocket/ws_server.cc
index 6319a67f..a8d89b36 100644
--- a/src/daemon/entry/cri/streams/websocket/ws_server.cc
+++ b/src/daemon/entry/cri/streams/websocket/ws_server.cc
@@ -551,6 +551,8 @@ void WebsocketServer::ServiceWorkThread(int threadid)
while (n >= 0 && m_forceExit == 0) {
n = lws_service(m_context, 0);
+ // sleep some time to prevent the CPU from being occupied all the time
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
--
2.34.1
|