Skip to content

Commit a1342f3

Browse files
committed
Fixed a CPU scheduling bug
close #3322
1 parent aea7790 commit a1342f3

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* `FIX` Self-referential generic classes no longer cause infinite expansion in hover display [#1853](https://github.com/LuaLS/lua-language-server/issues/1853)
99
* `FIX` Generic type parameters now work in `@overload` annotations [#723](https://github.com/LuaLS/lua-language-server/issues/723)
1010
* `FIX` Methods with `@generic T` and `@param self T` now correctly resolve return type to the receiver's concrete type (e.g., `List<number>:identity()` returns `List<number>`) [#1000](https://github.com/LuaLS/lua-language-server/issues/1000)
11+
* `FIX` Fixed a CPU scheduling bug that prevented the full utilization of high-performance CPUs.
1112
* `FIX` convert all keys to string in `--check`
1213

1314
## 3.16.4

script/pub/pub.lua

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,12 @@ function m.recieve(block)
235235
selector:wait(-1)
236236
-- 遍历公共组
237237
for _, brave in ipairs(m.publicBraves) do
238-
if m.reciveFromPad(brave) then
239-
return
240-
end
238+
m.reciveFromPad(brave)
241239
end
242240
-- 遍历所有专用组
243241
for _, braveList in pairs(m.privateBraves) do
244242
for _, brave in ipairs(braveList) do
245-
if m.reciveFromPad(brave) then
246-
return
247-
end
243+
m.reciveFromPad(brave)
248244
end
249245
end
250246
else

script/service/service.lua

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,7 @@ function m.eventLoop()
168168
end
169169
end
170170

171-
local lastNetUpdateTime = 0
172171
local function doSomething()
173-
local now = time.monotonic()
174-
if now - lastNetUpdateTime >= 100 then
175-
net.update()
176-
lastNetUpdateTime = now
177-
end
178172
timer.update()
179173
pub.step(false)
180174
if await.step() then
@@ -185,17 +179,24 @@ function m.eventLoop()
185179
end
186180

187181
local function sleep()
188-
idle()
189-
for _ = 1, 10 do
190-
net.update(100)
191-
if doSomething() then
192-
return
182+
while true do
183+
idle()
184+
for _ = 1, 10 do
185+
net.update(100)
186+
if doSomething() then
187+
return
188+
end
193189
end
190+
pub.step(true)
194191
end
195-
pub.step(true)
196192
end
197193

198194
while true do
195+
net.update()
196+
local clock = os.clock()
197+
while os.clock() - clock < 0.1 do
198+
doSomething()
199+
end
199200
if doSomething() then
200201
goto CONTINUE
201202
end

0 commit comments

Comments
 (0)